properties become instance variables, a value must be available to assign to variables when object is instantiated
operations become callable methods, procedures or functions
can have implicit (as shown here) or explicit constructor (see constructor entry)
the class constructor is called to instantiate an object of the class when a new object is invoked and a pointer reference to the object is stored in a variable
Differences between
2
properties, data types, instance variables
3
encapsulation
Two concepts are involved:
information hiding: properties must be accessed using accessor and mutator methods rather then direct access
data attributes and related operations are bound together and can both be addressed using the object’s reference pointer
The UML typically has a single box for the class including a section for attributes / properties and another for methods / operations to convey the idea of them being part of the same construct
Access modifiers (typically private and public) are indicated in the diagram using - and + respectively. Attributes are normally private (information hiding) and (most) methods are public and present an interactive surface for other classes wishing to interact based on a relationship such as inheritance or association.
4
access modifiers
5
methods
6
constructor
7
instantiation
8
object reference variable
There are no rows in this table
What would a mind-map of these terms look like?
what would the key-term(s) be and why?
how would the terms be linked and why?
Can you rank or cluster the terms in regards how challenging they are for learners to develop a secure understanding? What insight or explanations might there be for the challenges?
FQ (codeHS)
An object is:
a template to make a program
a construct that has a set of property values and associated behaviours
a single block or module of code in a program
a variables with assigned values
classes and objects:
a class specifies the properties and methods of every object that will be made (for that class)
an object specifies the properties and methods of every class that will be made (for that object)
Each class specifies the properties and methods for a single object
Each object can be created from all or only selected properties and methods specified by the class
a class definition will include:
a name
a set of properties
a set of methods
all of the above
code (some of it wonky!)
1. SET person1 TO INTIALLY Person("Andy", "Murray", 35)