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
AddMemberAtRuntime
Java
AddMemberAtRuntime
Set of class members can change at runtime
AllClassesHaveDefaultConstructor
Java
DRAFT
AllClassesHaveDefaultConstructor
All classes automatically get a no-argument constructor
AnyClassException
Java
DRAFT
AnyClassException
Any class can be an exception class
ArithmeticPlusPrecedes
Java
ArithmeticPlusPrecedes
Addition has higher precedence than string concatenation
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
ArrayHasLengthMethod
Java
ArrayHasLengthMethod
To get the length of an array, one needs to call its length method
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
ArrayListIsArray
Java
ArrayListIsArray
ArrayLists are arrays
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
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
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
CallNotStaticallyChecked
Java
CallNotStaticallyChecked
A method invocation on a reference of a type that does not have that method won't compile
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
CannotChainMemberAccesses
Java
CannotChainMemberAccesses
Member accesses cannot be chained together
CannotChainMemberToConstructor
Java
CannotChainMemberToConstructor
Method calls or field accesses cannot be chained to a constructor invocation
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
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
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
ConditionalIsSequence
Java
ConditionalIsSequence
If-else is equivalent to sequence of two ifs
ConstructorAllocates
Java
ConstructorAllocates
The constructor allocates the object
ConstructorParameterIsField
Java
DRAFT
ConstructorParameterIsField
Formal constructor parameters are equivalent to instance variables
ConstructorReturnsObject
Java
ConstructorReturnsObject
Constructors need to return objects
ConstructorWithoutNew
Java
DRAFT
ConstructorWithoutNew
One can write the constructor name, without new, to instantiate a class
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
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
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
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
FinalReferenceImpliesImmutability
Java
FinalReferenceImpliesImmutability
An object referred to by a final variable is an immutable object
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
IfIsLoop
Java
IfIsLoop
The body of an if statement executes repeatedly, as long as the condition holds
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
LargeIntegerLong
Java
LargeIntegerLong
Large integer numbers have type long
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
LocalVariablesAutoInitialized
Java
LocalVariablesAutoInitialized
Local variables are automatically initialized
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
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
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
MustInitializeFieldInConstructor
Java
MustInitializeFieldInConstructor
Constructors must assign values to all fields
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
NoAtomicExpression
Java
NoAtomicExpression
Expressions must consist of more than one piece
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
NoEmptyConstructor
Java
NoEmptyConstructor
A constructor must do something
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
NoFloatLiterals
Java
NoFloatLiterals
There are no float literals
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
NoLongLiterals
Java
NoLongLiterals
There are no long literals
NoMethodInheritance
Java
DRAFT
NoMethodInheritance
Subclasses inherit fields but not methods
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
NoStringToString
Java
DRAFT
NoStringToString
One cannot invoke toString() on a String
NullIsObject
Java
NullIsObject
null is an object
NullPointerExceptionCompileTime
Java
DRAFT
NullPointerExceptionCompileTime
NullPointerExceptions are detected at compile time
NumericToBooleanCoercion
Java
DRAFT
NumericToBooleanCoercion
Numeric types can be coerced to boolean
ObjectsMustBeNamed
Java
ObjectsMustBeNamed
A variable is needed to instantiate an object
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
OutsideInMethodNesting
Java
OutsideInMethodNesting
Nested method calls are invoked outside in
ParenthesesOnlyIfArgument
Java
ParenthesesOnlyIfArgument
() are optional for method calls without arguments
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
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
PrivateMeansFinal
Java
DRAFT
PrivateMeansFinal
A private field cannot be changed
RationalLiterals
Java
DRAFT
RationalLiterals
Rational fractions are literals
RecursiveActivationsShareFrame
Java
RecursiveActivationsShareFrame
Recursive calls of a method share a stack frame
RecursiveCallSiteNoReturn
Java
DRAFT
RecursiveCallSiteNoReturn
Tail-recursive call sites have no continuation
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
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
ReferenceToVariable
Java
ReferenceToVariable
References can point to variables
ReferringToRecursiveStructureMakesRecursive
Java
DRAFT
ReferringToRecursiveStructureMakesRecursive
A class referring to a recursive data structure is (indirectly) part of that recursion as well
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
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
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
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
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
ThisInConstructorIsNull
Java
DRAFT
ThisInConstructorIsNull
In a constructor, this is null
ThisNoExpression
Java
ThisNoExpression
The name this is not an expression
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
VariablesHoldExpressions
Java
VariablesHoldExpressions
= stores an expression in a variable
VariablesHoldObjects
Java
VariablesHoldObjects
A variable of a reference type contains a whole object
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'
AssignmentCopiesObject
JavaScript
AssignmentCopiesObject
Assignment copies the object
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
ClassDefinesType
JavaScript
ClassDefinesType
The type of an object is equivalent to the type defined by its class definition
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
ConstReferenceImpliesImmutability
JavaScript
ConstReferenceImpliesImmutability
An object referred to by a const variable is an immutable object
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
NoAtomicExpression
JavaScript
NoAtomicExpression
Expressions must consist of more than one piece
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
NullIsObject
JavaScript
NullIsObject
null is an object
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
ThisAssignable
JavaScript
ThisAssignable
One can assign to this
TypeofArrayIsArray
JavaScript
DRAFT
TypeofArrayIsArray
The typeof operator applied on an array returns 'array'
TypeofNullIsNull
JavaScript
DRAFT
TypeofNullIsNull
The value null is of type 'null'
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
NoSequenceRepetition
Python
DRAFT
NoSequenceRepetition
There is no operator that repeats sequences
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
PlusConcatenatesNumbers
Python
DRAFT
PlusConcatenatesNumbers
The plus operator can concatenate strings and numbers
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.