Misconceptions

Here are a couple of misconceptions. Many more to come...

Misconception Count Does Not Imply Language Difficulty

The 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.

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

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.