Misconceptions

These are the misconceptions we collected so far in:

Misconception Count Does Not Imply Language Difficulty

There is no connection between the number of misconceptions listed here and the difficulty of the corresponding programming language. The effort we spent on collecting misconceptions is very different for different languages. It would be inappropriate to reason about the quality of languages based on the number of misconceptions in this collection.

AbstractClassMustImplementAbstractMethod
Java
DRAFT
AbstractClassMustImplementAbstractMethod
An abstract class must implement all abstract methods defined in its superclass
AbstractClassNoImplementation
Java
DRAFT
AbstractClassNoImplementation
An abstract class cannot contain implemented methods
AllClassesHaveDefaultConstructor
Java
DRAFT
AllClassesHaveDefaultConstructor
All classes automatically get a no-argument constructor
AnyClassException
Java
DRAFT
AnyClassException
Any class can be an exception class
ArrayAccessWithParentheses
Java
DRAFT
ArrayAccessWithParentheses
Parenthesis are used to access an element in an array
ArrayAllocationWithoutNew
Java
DRAFT
ArrayAllocationWithoutNew
Arrays are created without the new keyword
ArrayBracketCountIsLength
Java
DRAFT
ArrayBracketCountIsLength
The number of brackets in an array type or an array initializer corresponds to the length of the array
ArrayElementTypeRepeats
Java
DRAFT
ArrayElementTypeRepeats
The type of a multi-dimensional array is written as T[] T[] T[]
ArrayElementsUntyped
Java
DRAFT
ArrayElementsUntyped
Elements of arrays are untyped
ArrayInitializerContentsInBrackets
Java
DRAFT
ArrayInitializerContentsInBrackets
Array initializers list the elements in square brackets
ArrayLengthCannotBeZero
Java
DRAFT
ArrayLengthCannotBeZero
An array cannot have a length of 0 elements
ArrayLengthPartOfType
Java
DRAFT
ArrayLengthPartOfType
The length of an array is part of its type
ArrayRankIsLength
Java
DRAFT
ArrayRankIsLength
Array rank and array length are the same thing
ArrayRankNotPartOfType
Java
DRAFT
ArrayRankNotPartOfType
The rank of an array is not part of its type
BaseCaseNotNeeded
Java
DRAFT
BaseCaseNotNeeded
Recursive computations do not necessarily need a base case
BaseCaseSelfRecursive
Java
DRAFT
BaseCaseSelfRecursive
The base case of a structural recursion consists of a recursive self-call
BoxedNull
Java
DRAFT
BoxedNull
Passing null to a wrapper class constructor creates an object representing the absence of a value
CallOnPrimitive
Java
DRAFT
CallOnPrimitive
One can invoke a method on primitive values
CallRequiresVariable
Java
DRAFT
CallRequiresVariable
One needs a variable to invoke a method
CallWithoutFrame
Java
DRAFT
CallWithoutFrame
A method invocation does not necessarily allocate a stack frame
CallerFrameContainsCalleeFormal
Java
DRAFT
CallerFrameContainsCalleeFormal
Stack frame of caller includes variables for callee's formal parameters
CatchAlwaysExecutes
Java
DRAFT
CatchAlwaysExecutes
Catch blocks always get executed
CatchProvidesOptions
Java
DRAFT
CatchProvidesOptions
Only the part of a catch block necessary to fix the cause of an exception is executed
ChainedMethodsNotCalledFromOutside
Java
DRAFT
ChainedMethodsNotCalledFromOutside
Chained methods are all called on the object at the beginning of the chain
CompositeExpressionsUntyped
Java
DRAFT
CompositeExpressionsUntyped
Expressions that consist of multiple parts have no type
ConcreteClassMustOverride
Java
DRAFT
ConcreteClassMustOverride
A concrete class needs to implement all abstract methods and override all concrete methods declared in its abstract superclasses
ConcreteClassOnlyImplementClassAbstract
Java
DRAFT
ConcreteClassOnlyImplementClassAbstract
A concrete class only needs to implement those abstract methods it inherits from abstract superclasses
ConcreteClassOnlyImplementDirectAbstract
Java
DRAFT
ConcreteClassOnlyImplementDirectAbstract
A concrete class only needs to implement abstract methods declared in its direct supertypes
ConcreteClassOnlyImplementInterfaceAbstract
Java
DRAFT
ConcreteClassOnlyImplementInterfaceAbstract
A concrete class only needs to implement those abstract methods it inherits from interfaces
ConstructorParameterIsField
Java
DRAFT
ConstructorParameterIsField
Formal constructor parameters are equivalent to instance variables
ConstructorWithoutNew
Java
DRAFT
ConstructorWithoutNew
One can write the constructor name, without new, to instantiate a class
ElsIf
Java
DRAFT
ElsIf
There is an elsif keyword for multi-way conditional statements
ElseAlwaysExecutes
Java
DRAFT
ElseAlwaysExecutes
The else branch of an if-else statement always executes
EvaluationResultsArePrinted
Java
DRAFT
EvaluationResultsArePrinted
Evaluating an expression means outputting its result
ExceptionRoot
Java
DRAFT
ExceptionRoot
Exception is the top-most exception class
ExpressionAssigns
Java
DRAFT
ExpressionAssigns
An expression that reads a variable also updates its value after the evaluation
ExpressionsDynamicallyTyped
Java
DRAFT
ExpressionsDynamicallyTyped
One has to evaluate an expression to determine its type
ForEachIteratesOverIndices
Java
DRAFT
ForEachIteratesOverIndices
An enhanced for loop iterates over the indices of an array or a collection
ForEachTraversesRecursiveStructure
Java
DRAFT
ForEachTraversesRecursiveStructure
For-each loops know how to traverse any recursive data structure
ForEachVariableIsElement
Java
DRAFT
ForEachVariableIsElement
One can assign to the variable of an enhanced for statement to store a value in the corresponding array or collection element
ForIsConditional
Java
DRAFT
ForIsConditional
The body of a for statement executes at most once
ForVariableScopeBeyondLoop
Java
DRAFT
ForVariableScopeBeyondLoop
The scope of variables declared in a for loop header extends beyond the loop
FrameIsClassInstance
Java
DRAFT
FrameIsClassInstance
A stack frame is the same as an instance of a class
IfRequiresElse
Java
DRAFT
IfRequiresElse
Every if statement requires an else
ImmutableRequiresFinalParameters
Java
DRAFT
ImmutableRequiresFinalParameters
Immutable classes need final constructor/method parameters
ImplicitInterfaceImplementation
Java
DRAFT
ImplicitInterfaceImplementation
Java implicitly produces implementations of any methods a class inherits from the interfaces it implements
IntegerDivisionToRational
Java
DRAFT
IntegerDivisionToRational
Dividing two integers can produce a rational number
InterfaceExtendClass
Java
DRAFT
InterfaceExtendClass
An interface can extend a class
LiteralNoExpression
Java
DRAFT
LiteralNoExpression
A literal is not an expression
LiteralString
Java
DRAFT
LiteralString
When passing a literal string as argument to a method, no quotes are needed
LoopBodyScopeImpliesLoopLifetime
Java
DRAFT
LoopBodyScopeImpliesLoopLifetime
Lifetime of variables declared in a loop body extends across all loop iterations
LoopTerminatingCondition
Java
DRAFT
LoopTerminatingCondition
For and while loops end when the condition becomes true
MapIsMultiMap
Java
DRAFT
MapIsMultiMap
Maps can store multiple values for a given key
MapPutNoOverwrite
Java
DRAFT
MapPutNoOverwrite
Map.put with an existing key does nothing
MethodAsField
Java
DRAFT
MethodAsField
Each object contains its own special fields for all of its methods
MethodWithoutReturnType
Java
DRAFT
MethodWithoutReturnType
A method declaration does not need to include a return type
MethodsWithoutClass
Java
DRAFT
MethodsWithoutClass
Methods can be defined outside a class
MultiReferenceVariable
Java
DRAFT
MultiReferenceVariable
A reference variable can point to multiple objects
MultiValueVariable
Java
DRAFT
MultiValueVariable
A variable can contain more than one value
MultidimensionalArray
Java
DRAFT
MultidimensionalArray
A multi-dimensional array is one single array object
MultipleSuperclasses
Java
DRAFT
MultipleSuperclasses
A class can have multiple superclasses
NamedTypeParameter
Java
DRAFT
NamedTypeParameter
To instantiate a generic type, one needs to specify type parameter names as well as types
NestedObjectsImplyNestedClasses
Java
DRAFT
NestedObjectsImplyNestedClasses
If objects are part of a containment hierarchy, their classes are nested, too
NestedPackages
Java
DRAFT
NestedPackages
Packages can contain other packages
NoCallOnStringLiteral
Java
DRAFT
NoCallOnStringLiteral
One cannot invoke methods on String literals
NoCastIfSameSize
Java
DRAFT
NoCastIfSameSize
If a variable is at least as big (bit-width) as a value, then no cast is needed to a assign the value to the variable
NoCharEscape
Java
DRAFT
NoCharEscape
\ is a normal character in char and String literals
NoFieldInheritance
Java
DRAFT
NoFieldInheritance
An object contains only the fields declared in its class
NoFieldlessObjects
Java
DRAFT
NoFieldlessObjects
Objects without instance variables can't exist
NoImplicitWidening
Java
DRAFT
NoImplicitWidening
Smaller types are never automatically converted into bigger ones without an explicit cast
NoInsideMethodCallInConstructor
Java
DRAFT
NoInsideMethodCallInConstructor
It is foirbidden to call other methods on the same object while inside its constructor
NoJaggedArrays
Java
DRAFT
NoJaggedArrays
Multi-dimensional arrays have a rectangular shape
NoLocalVariables
Java
DRAFT
NoLocalVariables
There are no local variables
NoMethodInheritance
Java
DRAFT
NoMethodInheritance
Subclasses inherit fields but not methods
NoStringToString
Java
DRAFT
NoStringToString
One cannot invoke toString() on a String
NullPointerExceptionCompileTime
Java
DRAFT
NullPointerExceptionCompileTime
NullPointerExceptions are detected at compile time
NumericToBooleanCoercion
Java
DRAFT
NumericToBooleanCoercion
Numeric types can be coerced to boolean
OnlyInnermostArrayElements
Java
DRAFT
OnlyInnermostArrayElements
Only the elements of the innermost array of a multi-dimensional array are accessible
OnlyRuntimeLibraryPackages
Java
DRAFT
OnlyRuntimeLibraryPackages
Only the creators of the JDK can create packages
OutOfBoundsElementsAreNull
Java
DRAFT
OutOfBoundsElementsAreNull
Out-of-bounds array elements are null
PreIncrementBeforeLoop
Java
DRAFT
PreIncrementBeforeLoop
Pre-increment in update part of for loop means increment before loop body
PrimitiveIsObject
Java
DRAFT
PrimitiveIsObject
Primitive values are heap objects
PrimitiveTypeParameter
Java
DRAFT
PrimitiveTypeParameter
Type parameters of generic types can be assigned primitive types
PrimitiveVariablesDynamicallyTyped
Java
DRAFT
PrimitiveVariablesDynamicallyTyped
The type of a primitive variable depends on its value
PrintNewLineFirst
Java
DRAFT
PrintNewLineFirst
println(...) starts a new line and then prints
PrivateAccessibleInSubclass
Java
DRAFT
PrivateAccessibleInSubclass
Private members of a superclass are accessible from a subclass
PrivateFieldsImplyImmutability
Java
DRAFT
PrivateFieldsImplyImmutability
A class where all fields are private is immutable
PrivateMeansFinal
Java
DRAFT
PrivateMeansFinal
A private field cannot be changed
RationalLiterals
Java
DRAFT
RationalLiterals
Rational fractions are literals
RecursiveCallSiteNoReturn
Java
DRAFT
RecursiveCallSiteNoReturn
Tail-recursive call sites have no continuation
ReferenceIntoStack
Java
DRAFT
ReferenceIntoStack
References can point into the stack
ReferenceToBooleanCoercion
Java
DRAFT
ReferenceToBooleanCoercion
Every reference type can be coerced to boolean
ReferenceToIntegerConversion
Java
DRAFT
ReferenceToIntegerConversion
One can cast between references and ints
ReferringToRecursiveStructureMakesRecursive
Java
DRAFT
ReferringToRecursiveStructureMakesRecursive
A class referring to a recursive data structure is (indirectly) part of that recursion as well
RuntimeExceptionChecked
Java
DRAFT
RuntimeExceptionChecked
RuntimeExceptions are checked exceptions
SemanticEquivalenceImpliesSyntacticEquivalence
Java
DRAFT
SemanticEquivalenceImpliesSyntacticEquivalence
Two pieces of code with the same observable behavior have to be implemented in the same way
SetterIsStatic
Java
DRAFT
SetterIsStatic
Setter methods are static
SingleQuoteString
Java
DRAFT
SingleQuoteString
String literals can be in single quotes
StackTraceIsCallHistory
Java
DRAFT
StackTraceIsCallHistory
A stack trace is the sequence of previously called methods
StaticCallPolymorphic
Java
DRAFT
StaticCallPolymorphic
A static method call is dispatched polymorphically at runtime based on the argument types
StaticDispatch
Java
DRAFT
StaticDispatch
The method to be called is determined by the static type
StringLengthField
Java
DRAFT
StringLengthField
One can know the length of a String object by accessing its length field
StringRepetitionOperator
Java
DRAFT
StringRepetitionOperator
The multiplication operator can repeat a String a number of times
SubtypeCompatibleWithSupertype
Java
DRAFT
SubtypeCompatibleWithSupertype
A variable of a subtype can reference an object of a supertype
SuperAlwaysHasParentheses
Java
DRAFT
SuperAlwaysHasParentheses
To call a method on a superclass, parentheses are needed after the keyword super
SuperNotFirstStatement
Java
DRAFT
SuperNotFirstStatement
super() can be called anywhere in the constructor of a subclass
SuperclassObjectAllocated
Java
DRAFT
SuperclassObjectAllocated
When instantiating an object of a subclass, an object of a superclass is also allocated
SupertypeIncompatibleWithSubtype
Java
DRAFT
SupertypeIncompatibleWithSubtype
A variable of a supertype cannot reference an object of a subtype
TargetTyping
Java
DRAFT
TargetTyping
The type of a numerical expression depends on the type expected by the surrounding context
ThisAsField
Java
DRAFT
ThisAsField
this is a special field in the object
ThisInConstructorIsNull
Java
DRAFT
ThisInConstructorIsNull
In a constructor, this is null
ToStringPrints
Java
DRAFT
ToStringPrints
Invoking toString() prints something
TryCatchMandatory
Java
DRAFT
TryCatchMandatory
If code could throw an exception, you must surround that code with a try/catch block
TryFinishes
Java
DRAFT
TryFinishes
Exceptions get thrown at the end of the try block
UndeclaredVariables
Java
DRAFT
UndeclaredVariables
Variables don't need to be declared
UnqualifiedNamesMustDiffer
Java
DRAFT
UnqualifiedNamesMustDiffer
The unqualified names of different classes must be different
UntypedVariables
Java
DRAFT
UntypedVariables
Variable declarations don't need a type
UseOfSelfTypeImpliesRecursiveType
Java
DRAFT
UseOfSelfTypeImpliesRecursiveType
If a class has a method that has a local variable, parameter, or return value with the class as its type, the class is a recursive type
VoidMethodNotRecursive
Java
DRAFT
VoidMethodNotRecursive
A method with void return type can't be recursive
VoidMethodReturnsValue
Java
DRAFT
VoidMethodReturnsValue
A method with void return type can return a value
ZeroDigitsCompress
Java
DRAFT
ZeroDigitsCompress
In integer numbers, decimal digits with value `0` take less storage than decimal digits with other values
AccessingInexistentPropertyError
JavaScript
DRAFT
AccessingInexistentPropertyError
Accessing a non existent property on an object produces an error
ArrowFunctionNoImpliedReturn
JavaScript
DRAFT
ArrowFunctionNoImpliedReturn
Even when an arrow function consists just of an expression, the return keyword must be explicitly written
ArrowFunctionRequiresFunctionKeyword
JavaScript
DRAFT
ArrowFunctionRequiresFunctionKeyword
Arrow functions also require the keyword 'function'
CallbackParametersInCaller
JavaScript
DRAFT
CallbackParametersInCaller
Parameters of a callback function may be written as parameters of the caller function
CharType
JavaScript
DRAFT
CharType
A single character is of type char
ConditionalOperatorNotExpression
JavaScript
DRAFT
ConditionalOperatorNotExpression
The conditional operator is not an expression
ConstDeclarationCanBeLeftUninitialized
JavaScript
DRAFT
ConstDeclarationCanBeLeftUninitialized
Declarations of constants do not need to be immediately initialized
EqualityOperatorComparesObjectsValues
JavaScript
DRAFT
EqualityOperatorComparesObjectsValues
The equality operator compares two objects' values
EqualityOperatorComparesOnlyTypes
JavaScript
DRAFT
EqualityOperatorComparesOnlyTypes
The equality operator '==' compares only the types of the operands
FunctionAsValueWithParentheses
JavaScript
DRAFT
FunctionAsValueWithParentheses
To use a function as a value, one needs to have parentheses after its name
FunctionOverloading
JavaScript
DRAFT
FunctionOverloading
It is possible to create multiple functions with the same name but with different signatures
FunctionsCannotBeImmediatelyInvoked
JavaScript
DRAFT
FunctionsCannotBeImmediatelyInvoked
Functions cannot be called in the expression in which they are defined
FunctionsMustBeNamed
JavaScript
DRAFT
FunctionsMustBeNamed
Every function definition requires an associated name
IdentifierAsStringInBracketNotation
JavaScript
DRAFT
IdentifierAsStringInBracketNotation
An identifier used to access a property with the bracket notation is treated as a string
MandatoryAssignment
JavaScript
DRAFT
MandatoryAssignment
An expression must be assigned to have a valid statement
MapInPlace
JavaScript
DRAFT
MapInPlace
Map modifies the elements of the array on which it operates in place
NoBracketNotationForObjects
JavaScript
DRAFT
NoBracketNotationForObjects
Square brackets cannot be used to access properties of an object
NoFunctionCallsChaining
JavaScript
DRAFT
NoFunctionCallsChaining
It is not allowed to chain function calls
NoGlobalObject
JavaScript
DRAFT
NoGlobalObject
There isn't a global object
NoReturnValue
JavaScript
DRAFT
NoReturnValue
Functions without return statements return no value at all
NullAndUndefinedAreTheSame
JavaScript
DRAFT
NullAndUndefinedAreTheSame
The values null and undefined are the same
NumberOfParametersMatchArguments
JavaScript
DRAFT
NumberOfParametersMatchArguments
Functions must be called with the same number of arguments as defined in their signature
ObjectAsParameterIsCopied
JavaScript
DRAFT
ObjectAsParameterIsCopied
Objects are passed by value
PrototypesAreClasses
JavaScript
DRAFT
PrototypesAreClasses
JavaScript is based on a class-based object model
SetTimeout0IsSynchronous
JavaScript
DRAFT
SetTimeout0IsSynchronous
Scheduling the execution of a function after 0 milliseconds with setTimeout is equivalent to a synchronous call
SetTimeoutReturnsCallbackResult
JavaScript
DRAFT
SetTimeoutReturnsCallbackResult
SetTimeout returns the value returned by the callback function
StringRepetitionOperator
JavaScript
DRAFT
StringRepetitionOperator
One can repeat a String by multiplying it with a number
TypeofArrayIsArray
JavaScript
DRAFT
TypeofArrayIsArray
The typeof operator applied on an array returns 'array'
TypeofNullIsNull
JavaScript
DRAFT
TypeofNullIsNull
The value null is of type 'null'
NoSequenceRepetition
Python
DRAFT
NoSequenceRepetition
There is no operator that repeats sequences
PlusConcatenatesNumbers
Python
DRAFT
PlusConcatenatesNumbers
The plus operator can concatenate strings and numbers

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.