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
Java
AssignmentCopiesObject
Assignment copies the object
JavaScript
AssignmentCopiesObject
Assignment copies the object
Java
AssignmentNotExpression
An assignment a=b is not an expression
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
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
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
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
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
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
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
Java
NoShortCircuit
&& and || 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
Java
OutsideInMethodNesting
Nested method calls are invoked outside in
Java
ParenthesesOnlyIfArgument
() are optional for method 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
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
Java
ReturnCall
Return statements need () around the return value
Java
ReturnUnwindsMultipleFrames
A return statement can unwind multiple call stack frames
Java
RightToLeftChaining
Chained accesses are invoked from right to left
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
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
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.