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.

AddMemberAtRuntime
Java
AddMemberAtRuntime
Set of class members can change at runtime
ArithmeticPlusPrecedes
Java
ArithmeticPlusPrecedes
Addition has higher precedence than string concatenation
ArrayHasLengthMethod
Java
ArrayHasLengthMethod
To get the length of an array, one needs to call its length method
ArrayListIsArray
Java
ArrayListIsArray
ArrayLists are arrays
ArraysGrow
Java
ArraysGrow
Arrays can grow dynamically
AssignCompares
Java
AssignCompares
= compares two values
AssignmentCopiesObject
Java
AssignmentCopiesObject
Assignment copies the object
AssignmentNotExpression
Java
AssignmentNotExpression
An assignment a=b is not an expression
CallNotStaticallyChecked
Java
CallNotStaticallyChecked
A method invocation on a reference of a type that does not have that method won't compile
CannotChainMemberAccesses
Java
CannotChainMemberAccesses
Member accesses cannot be chained together
CannotChainMemberToConstructor
Java
CannotChainMemberToConstructor
Method calls or field accesses cannot be chained to a constructor invocation
CharNotNumeric
Java
CharNotNumeric
Char is not a numeric type
ComparisonWithBooleanLiteral
Java
ComparisonWithBooleanLiteral
To test whether an expression is true or false, one must compare it to true or to false
ConditionalIsSequence
Java
ConditionalIsSequence
If-else is equivalent to sequence of two ifs
ConstructorAllocates
Java
ConstructorAllocates
The constructor allocates the object
ConstructorReturnsObject
Java
ConstructorReturnsObject
Constructors need to return objects
ControlledLocalAccess
Java
ControlledLocalAccess
One can control access to local variables using access modifiers
DeferredReturn
Java
DeferredReturn
A return statement in the middle of a method doesn't return immediately
EqualityOperatorComparesObjectsValues
Java
EqualityOperatorComparesObjectsValues
o==p compares the objects referred to by variables o and p
EqualsComparesReferences
Java
EqualsComparesReferences
o.equals(p) compares the references stored in the variables o and p
FinalReferenceImpliesImmutability
Java
FinalReferenceImpliesImmutability
An object referred to by a final variable is an immutable object
IfIsLoop
Java
IfIsLoop
The body of an if statement executes repeatedly, as long as the condition holds
LargeIntegerLong
Java
LargeIntegerLong
Large integer numbers have type long
LocalVariablesAutoInitialized
Java
LocalVariablesAutoInitialized
Local variables are automatically initialized
MapToBooleanWithConditionalOperator
Java
MapToBooleanWithConditionalOperator
To map a boolean expression to a boolean, a conditional operator is necessary
MapToBooleanWithIf
Java
MapToBooleanWithIf
To map a boolean expression to a boolean, an if statement is necessary
MustInitializeFieldInConstructor
Java
MustInitializeFieldInConstructor
Constructors must assign values to all fields
NoAtomicExpression
Java
NoAtomicExpression
Expressions must consist of more than one piece
NoEmptyConstructor
Java
NoEmptyConstructor
A constructor must do something
NoFloatLiterals
Java
NoFloatLiterals
There are no float literals
NoLongLiterals
Java
NoLongLiterals
There are no long literals
NoReservedWords
Java
NoReservedWords
Every sequence of letters and digits starting with a letter can be used as an identifier
NoShortCircuit
Java
NoShortCircuit
&& and || always evaluate both operands
NoSingleLogicAnd
Java
NoSingleLogicAnd
& is only a bitwise AND
NullIsObject
Java
NullIsObject
null is an object
ObjectsMustBeNamed
Java
ObjectsMustBeNamed
A variable is needed to instantiate an object
OutsideInMethodNesting
Java
OutsideInMethodNesting
Nested method calls are invoked outside in
ParenthesesOnlyIfArgument
Java
ParenthesesOnlyIfArgument
() are optional for method calls without arguments
PrivateFromOtherInstance
Java
PrivateFromOtherInstance
An object cannot access private members of other objects of the same class
PrivateFromStatic
Java
PrivateFromStatic
Static methods cannot access private members of instances of same class
RecursiveActivationsShareFrame
Java
RecursiveActivationsShareFrame
Recursive calls of a method share a stack frame
RecursiveMethodImpliesRecursiveType
Java
RecursiveMethodImpliesRecursiveType
A class with a recursive method represents part of a recursive data structure
RecursiveMethodNeedsIfElse
Java
RecursiveMethodNeedsIfElse
A recursive method needs to contain an if-else statement
ReferenceToVariable
Java
ReferenceToVariable
References can point to variables
ReturnCall
Java
ReturnCall
Return statements need () around the return value
ReturnUnwindsMultipleFrames
Java
ReturnUnwindsMultipleFrames
A return statement can unwind multiple call stack frames
RightToLeftChaining
Java
RightToLeftChaining
Chained accesses are invoked from right to left
StringLiteralNoObject
Java
StringLiteralNoObject
One needs to call the String constructor to get a String object from a literal
StringPlusStringifiesExpression
Java
StringPlusStringifiesExpression
String concatenation stringifies non-String operand expressions
ThisAssignable
Java
ThisAssignable
One can assign to this
ThisCanBeNull
Java
ThisCanBeNull
this can be null
ThisExistsInStaticMethod
Java
ThisExistsInStaticMethod
this is a local variable, also in static methods
ThisNoExpression
Java
ThisNoExpression
The name this is not an expression
VariablesHoldExpressions
Java
VariablesHoldExpressions
= stores an expression in a variable
VariablesHoldObjects
Java
VariablesHoldObjects
A variable of a reference type contains a whole object
AssignmentCopiesObject
JavaScript
AssignmentCopiesObject
Assignment copies the object
ClassDefinesType
JavaScript
ClassDefinesType
The type of an object is equivalent to the type defined by its class definition
ConstReferenceImpliesImmutability
JavaScript
ConstReferenceImpliesImmutability
An object referred to by a const variable is an immutable object
NoAtomicExpression
JavaScript
NoAtomicExpression
Expressions must consist of more than one piece
NullIsObject
JavaScript
NullIsObject
null is an object
ThisAssignable
JavaScript
ThisAssignable
One can assign to this
AssignCompares
Python
AssignCompares
= compares two values
AssignmentCopiesObject
Python
AssignmentCopiesObject
Assignment copies the object
CannotChainAttributeToObjectInstantiation
Python
CannotChainAttributeToObjectInstantiation
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.
ComparisonWithBoolLiteral
Python
ComparisonWithBoolLiteral
To test whether an expression is True or False, one must compare it to True or to False
ConditionalIsSequence
Python
ConditionalIsSequence
If-else is equivalent to sequence of two ifs
DeferredReturn
Python
DeferredReturn
A return statement in the middle of a function doesn't return immediately
IfIsLoop
Python
IfIsLoop
The body of an if-statement executes repeatedly, as long as the condition holds
InitCreates
Python
InitCreates
__init__ must create a new object
InitReturnsObject
Python
InitReturnsObject
__init__ needs to return an object
MapToBooleanWithIf
Python
MapToBooleanWithIf
To map a boolean expression to a bool, an if statement is necessary
MapToBooleanWithTernaryOperator
Python
MapToBooleanWithTernaryOperator
To map a boolean expression to a bool, a ternary conditional operator is necessary
MultipleValuesReturn
Python
MultipleValuesReturn
Functions can return multiple values
NoAtomicExpression
Python
NoAtomicExpression
Expressions must consist of more than one piece
NoEmptyInit
Python
NoEmptyInit
__init__ must do something
NoReservedWords
Python
NoReservedWords
Every sequence of letters and digits starting with a letter or an underscore can be used as an identifier
NoShortCircuit
Python
NoShortCircuit
and/or always evaluate both operands
ObjectsMustBeNamed
Python
ObjectsMustBeNamed
A variable is needed to instantiate an object
OutsideInFunctionNesting
Python
OutsideInFunctionNesting
Nested function calls are invoked outside in
ParenthesesOnlyIfArgument
Python
ParenthesesOnlyIfArgument
() are optional for function calls without arguments
RecursiveFunctionNeedsIfElse
Python
RecursiveFunctionNeedsIfElse
A recursive function needs to contain an if-else statement
ReturnCall
Python
ReturnCall
Return statements need () around the return value
ReturnUnwindsMultipleFrames
Python
ReturnUnwindsMultipleFrames
A return statement can unwind multiple call stack frames
RightToLeftChaining
Python
RightToLeftChaining
Chained accesses are invoked from right to left
SelfNoExpression
Python
SelfNoExpression
The name self is not an expression
VariablesHoldExpressions
Python
VariablesHoldExpressions
= stores an expression: it stores a reference to the expression in a variable
VariablesHoldObjects
Python
VariablesHoldObjects
A variable contains a whole object
BaseCaseNotNeeded
Scratch
BaseCaseNotNeeded
Recursive computations do not necessarily need a base case
CompareBooleanToConstant
Scratch
CompareBooleanToConstant
To test whether an expression evaluates to true or false, one must compare it to a constant
ConditionalIsSequence
Scratch
ConditionalIsSequence
If-then-else block is equivalent to sequence of two if-then blocks
ElseAlwaysExecutes
Scratch
ElseAlwaysExecutes
The else branch of an if-then-else block always executes
EqualityOperatorComparesListIdentities
Scratch
EqualityOperatorComparesListIdentities
(list a) = (list b) compares the identities of list a and list b
EqualityOperatorComparesOnlyTypes
Scratch
EqualityOperatorComparesOnlyTypes
() = () compares only the types of its operands
ExpressionAssigns
Scratch
ExpressionAssigns
An expression that reads a variable also updates its value after the evaluation
ListLengthCannotBeZero
Scratch
ListLengthCannotBeZero
A list cannot have a length of 0 items
ListsHomogeneous
Scratch
ListsHomogeneous
All items in a list must have the same type
MissingElseTerminates
Scratch
MissingElseTerminates
Blocks following an if without else will not execute if the condition is false
RepeatDistributes
Scratch
RepeatDistributes
Each block in a loop is repeated individually
ResetStateEachLoopIteration
Scratch
ResetStateEachLoopIteration
The computation of all loop iterations starts from the state before the loop
ResetStateEachProgramExecution
Scratch
ResetStateEachProgramExecution
Running a Scratch program first resets the state of the world and then executes the program

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.