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

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.