![]() |
subject > programming language construct > data item > variable |
![]() ![]() | ||||||||||||||||||||||||
variable comparison table |
Subject | declare by | have | be | cause | add to | access through | is a synonym of | is a subtopic of | implement | overuse | group | hide | have purpose | use in | access by | use | has definition | help | represent | use by | implement as | share by | identify by | contain |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
attribute | an implicit internal structure | private | a model unless it is relevant to the application - it will be needed to implement some requirement | public methods so that attributes are only given valid values and so that you can change the internal design of the class without affecting how users of the class interact with it | 9.2 - Principles Leading to Good Design | the pieces of data that describe some entity, so that programmers can manipulate that data as a unit | the details of data | the analysis and design stage before it is known how the attribute will be implemented | A simple data item present in all the instances of a class | a programmer to cope with the complexity of data | a variable number of things | an instance variable in Java | looking at the description of the system and searching for information that must be maintained about each class | different classes of objects depending on the type of the variable | ||||||||||
class variable | a value that is shared by all instances of a class | static variable | The Basics of Java | storing: | A data item present in a class that is shared by all instances of that class | all instances of the class | different classes of objects depending on the type of the variable | |||||||||||||||||
global variable | comment if it is non-obvious | common coupling | 9.2 - Principles Leading to Good Design | older programming languages | A variable that is accessible from all procedures in the system, or in the scope of just a specific set of modules (e.g. a Java package). | different classes of objects depending on the type of the variable | ||||||||||||||||||
instance variable | comment if it is non-obvious | as private as reasonably possible - almost never make them public | field | 2.3 - Instance Variables | an attribute or association | A data item present in all the instances of a class, normally used to implement associations and attributes | different classes of objects depending on the type of the variable | |||||||||||||||||
Java variable | giving the data type followed by the name of the variable | an interface as its type which means that, with the variable, you can invoke any operation supported by the interface | as private as possible | The Basics of Java | other variables and methods in any class in the same package by default | different classes of objects depending on the type of the variable | ||||||||||||||||||
reference | comment if it is non-obvious | 2.3 - Instance Variables | A variable that refers to an object | different classes of objects depending on the type of the variable | ||||||||||||||||||||
variable declared as a non-primitive data type | comment if it is non-obvious | The Basics of Java | the name of a class as their type | calling methods or accessing the object's instance variables | an instance of a class | |||||||||||||||||||
variable declared as primitive data type | comment if it is non-obvious | The Basics of Java | object in the sense that its contents is not an instance of any class |