click below
click below
Normal Size Small Size show me how
M250 Java book 2
Open Uni M250 Object Oriented Java Programming Book 2 (units 6-8)
Term | Definition |
---|---|
abstract class | A class that defines a common message protocol and common set of instance variables for its subclasses. In Java an abstract class cannot be instantiated. |
abstract method | A method declared as abstract. Methods that have no bodies. Must be implemented in any concrete subclasses of the class in which they are specified. Interfaces also specify abstract methods, which must be implemented by classes implementing the interface. |
access level | The scope for access that exists for a software component such as a method. There are four access levels in Java: public, private, protected and default. The default level occurs when no access modifier is specified. |
access modifier | One of three Java keywords (public, private, protected) which specify the visibility of variables and methods. |
annotation | An annotation is a piece of code in a source file that indicates a programmer's intention to the compiler. (eg @Override) |
assert | The keyword in a Java assertion statement used to indicate a condition that should be true in order for the code to be correct, particularly used in private methods. |
assertion | A statement in the Java language that enables you to test your assumptions about your program; a condition that a programmer believes should be true. |
bug | The cause of a run-time error. |
call stack | A representation of the order of methods called at some point during the execution of a program, shown as a stack of method names, with the first called method on the bottom and the last called method on the top. |
catch | The process of catching an exception, and the keyword introducing the clause in a try-catch statement that handles an exception. |
chained | Constructors are said to be chained, meaning that when an object is created, the constructor of all its superclasses are also called, either explicitly or implicitly. |
checked exception | An exception that the compiler requires the programmer to explicitly handle or declare may be thrown in a method header using a throws clause. These exceptions are ones that a programmer may reasonably be expected to catch or should be made aware of. |
class header | The line in a class definition which gives its access modifier, name and, optionally, the name of a class it extends and the name(s) of any interface(s) it implements. |
class method | A method declared with the keyword static, associated with a class rather than any of its instances. Class method cannot use the expression this or the keyword super. Class methods are invoked directly on the name of the class, using static binding. |
class variable | A variable declared with the keyword static. It is associated with a class rather than any of its instances, although each instance of a class can access its own class's class variables. A class only ever has one copy of each of its class variables. |
client (class) | In programming, an object that uses a service provided by some other (server) class. |
collaboration | The achievement of a software solution using two or more communicating objects. |
common message protocol | A set of messages shared by a number of classes. Often used to describe the set of messages specified by an abstract class for its concrete subclasses. |
compilation error | An error detected by a compiler when code is compiled (which is known as compile-time). No bytecode is generated if there are compilation errors. |
compiler | Software which checks that text written in a high-level language is correctly formed and, as far as can be determined before compilation, that it is meaningful source code for the language. |
concrete class | A class which is not abstract; a class for which instances can be created. |
constant | A constant is a variable whose value is fixed and unchangeable. Normally the keyword final is used to make a value into a constant. Where only a single value is needed for a class constants are declared as static. Static is not always used for constants. |
constant instance variable | Constants are usually declared as final static variables. However sometimes it makes more sense to define a constant as a final instance variable. |
constructor chaining | The process whereby constructors use super() to invoke constructors higher up their inheritance hierarchy. |
data field | A term encompassing instance variables and class variables as well as constants. |
debugging | The identification and removal of errors (bugs) from a program. |
default constructor | A zero-argument constructor that simply invokes super(). This constructor is provided automatically by the compiler when the programmer has not specified any constructor in a class. |
default values | The values used by default to initialise instance variables of a class, which may be overwritten by another, explicit, initialisation. |
defensive programming | A programming technique in which a method provides alternative paths to deal with expected and unexpected arguments. The method may return a Boolean to indicate success or failure, or use an exception to signal a failure. |
design by contract (DbC) | Programming technique in which a specification states a precondition for correct use of a method, and a postcondition that the method will achieve in event that its precondition is met. An exception is thrown by a method when its precondition is not met. |
design principle | In contrast to a guideline or suggestion, the word principle is reserved for recommendations that apply universally or nearly universally. In this module, the term design principle is applied to principles governing how code should be organised. |
direct interaction | Direct interaction is not a formal technical term, but a descriptive phrase used to describe a situation where one object has a reference to another, and this reference is used to affect the state or behaviour of the other object. |
direct subclass | A class is a direct subclass of another class if it is directly below that class in the class hierarchy. |
direct superclass | A class is a direct superclass of another class if it is directly above that class in the class hierarchy. In Java the keyword extends is used by a subclass to indicate its direct superclass. |
dynamic binding | The postponing of what method to select for execution in response to a message until run-time. The method selected depends on the class of object that receives the corresponding message, rather than on the type of the variable that references it. |
exception | Object that is thrown by a method or the JVM as the result of a run-time error. The exception object holds details of what went wrong, allowing the exception handler that catches the exception to take appropriate action or provide a useful error message |
exception handler | A block of code written to deal with (handle) an error that has been signalled within some program code. Error must have arisen in context of a try block, and the exception handler is in an associated catch block. try and catch make up a single statement. |
exception handling | The programmed catching of an exception and the subsequent execution of code to abandon or continue execution, or to restore the software to a meaningful state. |
failing fast | The programming philosophy which recommends that errors be signalled as soon as possible so that their cause can be more easily traced, and so that errors are not allowed to be passed on to other parts of a software system. Done by throwing an exception. |
final | The keyword final prevents a variable from ever having its value reassigned once it has an initial value. |
formatting guidelines | A set of guidelines which specify how program code should be laid out. |
hiding | The situation in which a superclass member is not directly accessible in a subclass due to the subclass defining a member with the same name or same signature. |
implement | In software development, to write the program code for some task or specification. We also say that a class implements an interface when it implements the interface and is able to understand all messages specified by method signatures of the interface. |
implements | A keyword in Java used in a class header to specify that the class implements a particular interface. |
indirect interaction | Not a formal technical term, but descriptive phrase to describe a situation where one object affects the state or behaviour of another object, without actually having reference to that object. |
indirect subclass | A class is an indirect subclass of another class if it inherits from that class via one or more intermediate classes. |
indirect superclass | A class is an indirect subclass of another class, if it is above that class in the class hierarchy but not directly above it. |
inheritance | A relationship between classes by which they are organised into a hierarchy. |
interface | Interface specifies a list of messages that a group of unrelated classes which are said to implement the interface must be able to receive. Interface lists only method headers no code, cannot declare any instance variables and cannot be instantiated. |
Java Language Specification (JLS) | The document that specifies the terminology used by the Java language and describes the manner in which various parts of the language work. |
Java Runtime Environment (JRE) | JRE consists of the JVM plus additional software, such as class libraries, that are needed to support the running of Java programs on different platforms. |
logical error | An error inn logic, such as iterating for an incorrect number of times, or indexing an array at an incorrect position. Such an error may or may not lead to a program crash. These may be detected while writing source code or during running of a program. |
maintainability | This is the extent to which a program can easily be maintained over a period of time during which the requirements for the software may change. |
member | The term member is a convenient word sometimes used to cover all of four following categories: class variables, class methods, instance variables and instance methods. Constructors are not members. Members are involved in inheritance. |
Object | The top-level class in Java. |
orchestrating instance | An orchestrating instance is a separate object used to tie together the different parts of a complicated interaction that do not seem to belong to any single one of the objects involved. |
overloading | A method is said to be overloaded when there are other methods, defined in the same class or inherited, with the same name but a different method signature. |
@Override | A Java annotation used to indicate that a method is intended to override an inherited method. |
overriding | The process of redefining (replacing) a method that would have been inherited from a superclass so as to cause it to have different behaviour. A method that overrides a method from a superclass has the same signature and return type as superclass method. |
polymorphic method | A method with the same signature as some other method, but which defines different behaviour. |
postcondition | A condition that is true after some code is executed. |
precondition | A condition that must be true before some code is executed in order for that code to behave correctly. The used of a method typically checks its precondition before using it. |
private | An access modifier that restricts access to a class member to objects of the class to which it belongs. |
protected | Java access modifier used to restrict access of a member of a class X to subclasses of X and classes within the same package as class X. |
public | An access modifier applied to a class member that allows all classes of object to have access. |
qualified | The qualified name of a member is its simple name prefixed by the name of its enclosing class. The parts of such names are separated by dots. This means that different classes can have members with the same names. |
recursive method | A method that calls itself as part of its method definition. This can lead to indefinite looping when an attempt is made to execute the method. However, used properly, it can be an extremely powerful approach. |
refactoring | Refactoring is when code is rewritten without changing its overall effect, but for the purpose of improving its design, removing code duplication, or improving maintainability. |
run-time | The period during which a program is executing, in contrast to the time period during which it is loaded or compiled. |
run-time error | Programming error that becomes apparent only when program is run, and has not been detected beforehand. They can be caused by logical errors, failure to account for different ways in which code might be used or conditions outside of programmer control. |
self-documenting code | Code written using well-chosen names and structures so as to make its intentions relatively clear when read. |
stack trace | A stack of textual information ordered from the last thing that happened down to the first thing that happened that is displayed when an exception is thrown and not handled; a representation of a call stack. |
static binding | The selection by the compiler at compile time of a method to be executed at run-time. In the case of class methods, the compiler chooses the method from the class whose name is used to qualify the method name, or based on the type of reference variable. |
substitutability | The principle in object-oriented programming whereby, wherever the system expects an object of type X, an object of class Y can always be substituted instead, where class Y is a subclass of X, or where class Y implements an interface of type X |
substitution | The technique of providing an instance of one class in a situation where an instance of a different class is expected. An object can be used as an actual argument to a method where formal arguments type has been declared as some superclass of the object. |
subtype | A type whose values or instances are substitutable for another type's values. |
super | A Java keyword that allows the writing of expressions to access members of a class that are inaccessible using the expression this, due to hiding or overriding. |
super() | Used within a constructor to invoke the constructor without any arguments in the direct superclass. May also be used with n arguments to invoke a superclass constructor with n formal arguments. |
supertype | A type that supports substitution of more specific types. Both interface types and superclass types are examples of supertypes. |
syntax | The syntax of a programming language is the set of rules governing the structure of the language, including its valid symbols, expressions and structures. |
syntax error | An error that occurs as a result of a failure to observe a syntax rule. Such an error is detected during compilation by a compiler. |
testing | The process of using test cases to check that code is behaving as the programmer intended, and to help discover bugs. |
this() | Used within a constructor to invoke the constructor without any arguments in the current class. May also be used with n arguments to invoke a constructor with n formal arguments in the current class. |
throw | The process of throwing an exception, also referred to as raising or signalling an exception. |
throws clause | A part of a method header beginning with the keyword throws, followed by a comma-separated list of any exceptions the programmer wants to declare to be thrown. If a checked exception is not handled, it must be declared in a throws clause. |
try-catch statement | An exception handling statement, a mechanism to catch exceptions. If a possible checked exception is not declared in a throws clause, it must be handled using a try-catch statement. |
unchecked exception | An exception for which the compiler does not require any explicit exception handling code and that the compiler does not require the programmer to declare as thrown in a method header. These are errors that may not be easily recovered from. |
utility class | A utility class is one that provides methods (usually static) that perform common functions. |
visibility | Visibility of an item in a class refers to whether or not parts of a class can access that item directly. |
workspace variable | Workspace variables behave like local variables, except that their lifetime lasts until you close or reset the workspace, rather than ending when a particular block has finished executing. |