Advanced Programming - Essential Terms & Definitions •
•
Operating System – o
A software intermediary that facilitates collaboration between hardware and software on a given computer.
o
Software controlling the overall operation of a multipurpose computer system, including such tasks as memory allocation, input and output distribution, interrupt processing, and job scheduling.
o
Its objectives are to use the computer hardware in an efficient manner, make user problem-solving easier, and control/execute application programs.
o
Some OS services are:
Access to I/O devices
File system manipulation
Resource allocation
Communications
Protection & security
Accounting (keep records about user and resources used)
An Integrated Development Environment (IDE) provides a programming environment as a single application. IDEs typically bundle a compiler, debugger, and GUI builder together.
Computer o
•
User Interface
IDE – o
•
A computer is a device capable of performing complex computations and calculations, processing information and making logical decisions.
Program – o
A program is a set of instructions designed to process data and guide the computer through orderly sets of actions specified by the programmer(s).
• •
Object Oriented Programming – o
•
Object-oriented programming, or OOP, is a method of software development that is used to design systems by grouping conceptually related code into “objects”, often these objects are representations of corresponding real-world entities, such as an Employee or a Car.
GUI -
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
o •
•
•
•
•
•
Graphical User Interface. Refers to the techniques involved in using graphics, along with a keyboard and a mouse, to provide an easy-to-use interface.
Class – o
The formal definition of an object. The class acts as the template from which an instance of an object is created at run time. The class defines the properties of the object and the methods used to control the object's behaviour.
o
It describes the rules by which objects behave; these objects are referred to as instances of that class. A class specifies the structure of data (a.k.a. properties, fields, attributes, data members) within each instance as well as methods (functions) (a.k.a. behaviours) which manipulate the data of the object and perform tasks.
Object – o
In OOP, an object is a structure that contains both data and methods that manipulate that data.
o
An object is an instance of a class.
Object properties – o
The set of descriptive data of an object.
o
Characteristics of a shape or object (eg, size, shape, number of faces, or ability to be stacked or rolled).
o
Information that describes a object. Also called attributes.
Object Methods – o
A method is a programmed procedure that is defined as part of a class and included in any object of that class.
o
In object-oriented programming, the term method refers to a subroutine that is exclusively associated either with a class (called class methods, static methods, or factory methods) or with an object (called instance methods)
Method (also known as action)– o
Code found in a class for responding to a message.
o
A method is a programmed procedure that is defined as part of a class and included in any object of that class.
o
The operations of a class are stored as methods. A method represents an action an object takes, or an operation the class performs.
Method signature –
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
o
•
Argument – o
•
•
•
•
•
In computer programming, especially object-oriented programming, a method is commonly identified by its unique method signature. This usually includes the method name, the number and type of its parameters, and its return type.
A data item specified in a method call. An argument can be a literal value, a variable, or an expression.
Interface – o
Use the keyword Implements to implement an interface in a class.
o
How other modules access an objects variables and/or methods.
o
The public members of a class.
o
Interfaces describe properties and methods like classes, but unlike classes, interfaces cannot provide any implementation.
o
Interfaces are used to create classes, or say they are implemented by a class.
o
An interface is a contract or protocol. The class that implements the interface must implement every aspect of that interface exactly as it is defined.
Event driven – o
A term for a programming methodology which is based on waiting for events, and processing each as it occurs.
o
a form of program structure, in which the program responds to events as they happen, instead of simply processing data in a pre-defined order.
An event – o
Is a click or key press etc.
o
Events are responses to stimuli.
Event handler – o
A special attribute that associates an object with an event. For instance, you can associate a button with a mouse click by using the onClick event handler.
o
A function designed into a program or script to do something in response to an action by a user; for example, "when button is clicked, change Web page."
Information Hiding – o
the principle of information hiding is the hiding of design decisions in a computer program that are most likely to change, thus protecting other parts of the program from change if the design decision is changed. The protection involves providing a stable interface which shields the remainder of the program from the implementation (the details that are most likely to change). In modern programming languages, the principle of information hiding
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
manifests itself in a number of ways, including encapsulation (given the separation of concerns) and polymorphism. •
Polymorphism – o
Polymorphism refers to the ability to define multiple classes with functionally different, yet identically named methods or properties that can be used interchangeably by client code at run time.
o
Methods are defined in higher level classes but coded in various ways in sub classes as long as the class interface is unchanged.
Interface based polymorphism – •
Interfaces describe properties and methods like classes, but unlike classes, interfaces cannot provide any implementation.
•
So Interface based polymorphism means that an interface is used to define the methods while they are implemented in the various classes.
Inheritance based polymorphism – •
•
•
•
Inheritance-based polymorphism involves defining all methods in a super class as well as implementing them and then overriding the methods with new implementations in sub classes.
Encapsulation – o
A technique for wrapping up data and its associated behaviours into a single unit or object e.g. class.
o
Encapsulation provides a controlled interface (namely the classes’ public methods) to manipulate an objects data.
o
Encapsulation supports information hiding.
Data Abstraction – o
Data abstraction is the clear separation between the abstract properties of a data type (class) and the concrete details of its implementation.
o
The abstract properties are those that are visible to client code i.e. the interface, while the concrete implementation is kept entirely private, which has no impact on the interface.
Messages – o
A single message cannot do much by itself. Objects interact with each other by sending messages. A message is information which is sent from a source to a receiver. The message contains the name of the object the message is addressed to, the name of the method to perform and any parameters needed by the method.
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
o
•
Code module – o
•
•
o
Attributes (also known as characteristics or properties) describe the states and appearance of an object.
o
Methods (or actions) carry out an action on an object’s data. Methods implement behaviours.
o
Behaviours (or actions), are used to describe the active behaviour of an object.
Client –
•
Any object or class outside the pattern; generally one that only knows about the public interface the pattern and its classes present, rather than about its private implementation.
Method overloading – o
•
Is a container for function or sub routine code not associated with specific code.
Attributes, Methods & Behaviours –
o
•
Messages are communications between objects. Messages specify actions for objects to take. The sender of the message is known as the agent. The sending of a message is known as an event.
Method overloading permits two methods to have the same name as each other, provided they can be distinguished by their argument lists (e.g. accept different number of arguments or arguments with different data types).
Method overriding – o
A subclass can override the definition of existing methods by providing its own implementation (code). This is method overriding.
o
Method overriding, in object oriented programming, is a language feature that allows a subclass to provide a specific implementation of a method that is already provided by one of its super classes. The implementation in the subclass overrides (replaces) the implementation in the super class.
Inheritance – o
The object-oriented concept where a child class also has the features (attributes and methods) of its parent class.
o
A mechanism for creating a new class using classes that have already been defined.
o
In essence, inheritance is all about software reuse.
o
A sub class inherits all instance attributes and behaviours of the super class from which it is derived.
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
•
•
Implementation inheritance – o
The ability that a sub class can inherit the public interfaces AND their implementations from its super class.
o
VB does not support implementation inheritance
Interface inheritance – o
•
•
•
•
The ability to inherit the public interface but not the implementation of a class.
Generalisation – o
Generalisation refers to the relationship between a class and one or more refined versions (sub classes) of it.
o
Generalisation usually leads to a super class.
o
In OOP generalisation implies the process of abstracting common properties and behaviours, and creating a class at high level abstraction for objects with sufficiently similar interface.
o
Example, A fruit is a generalisation of a apple, orange, pear etc
Specialisation – o
Generalisation refers to the relationship between a class and one or more refined versions (sub classes) of it.
o
Specialisation leads to a sub class through extension and method overriding.
o
Example, Apple is a specialisation of fruit.
o
If class A is a generalisation of class B, then class B is a specialisation of class A.
Class hierarchy – o
Inheritance relationships produce a tree like structure called a class hierarchy.
o
There is a “is a” relationship between a sub class and a super class.
o
Every object of a sub class is an object of that sub classes super class. But this does not hold conversely.
Collections – o
The concept of a collection in Visual Basic is simply a way to group similar objects. Both Visual Basic 6 and VB.NET provide a Collection class to give you the ability to define your own collections.
o
A collection usually consists of a group of objects of different types, known as its elements.
Form and Controls collection -
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
•
•
Default collection members have index values. They are 0 based, meaning that the index value starts from 0. Collections also have a count property.
Generic Collections – •
Used for grouping programmers own objects
•
Generic collections are 1-based
•
Generic collections have a single property, Count
•
The new collection must first be declared and bound to a variable name
•
E.g. Dim TeamStuff as New Collection
Compile error (including syntax errors), result from incorrectly constructed code.
o
o
•
VB provides default form and control collection objects for managing and accessing their elements.
Error types – o
•
•
E.g. incorrect usage of keywords, punctuation, operators, control structures etc.
Runtime errors, occur when the application is running and when a statement attempts an operation that is impossible to carry out.
Statements are syntactically correct
Must run before being detected
Logic errors, occur when an application doesn’t perform the way it was intended to.
In computer programming, a logic error is a bug in a program that causes it to operate incorrectly, but not to fail. Because a logic error will not cause the program to stop working, it can produce incorrect data that may not be immediately recognizable.
Would be caused by the programmer’s incorrect usage of an arithmetic operatic etc
File Types – o
Sequential access files
o
Random access files
Data Persistence – o
Information stored in variables and arrays is volatile.
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.
o
•
•
In computer science, persistence refers to the characteristic of data that outlives the execution of the program that created it. Without this capability, data only exists in memory, and will be lost when the memory loses power, such as on computer shutdown.
Modularity – o
An approach to developing hardware or software that breaks projects into smaller units (or modules) that are deliberately designed as standalone units that can work with other sections of the program. The same module can perform the same task in another or several other programs or components. Modifying the way that module works will have no adverse affects on the other components of a program.
o
Programs that have many direct interrelationships between any two random parts of the program code are less modular (more tightly coupled) than programs where those relationships occur mainly at well-defined interfaces between modules.
Divide & Conquer – o
A divide-and-conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually recursively), until the instances are small enough to solve easily.
Bloody well copyright © Ashe 2007 – 3007. Violation punished by penalty of death.