Compilation is the step of translation of a programme of a high-level language (
VB, C.) towards a low-level language (machine language). It is about a necessary stage before being able to run his programme.
|
Compiled language / interpreted |
An interpreted language (
javascript for example) is a language requiring no compilation, that is the programme is not translated in another language closer to the machine to be able to be carried out. In
contrario, a compiled language (C,
Delphi) requires the intervention of a compiler, that is to say of a programme translating code into machine language.
|
Language of top / low level |
A high-level language is a language close to us at the level of its syntax. For example:
Yes (name = "Pierre) Then to Write ("Good morning "). On the contrary a language low level is a language close to the machine as the filter (
mov 4 $, %eax).
|
Language side server / client |
It is a question here of differentiating the place of execution of a programme. A language side server (
php,
asp) sees its programmes complying on a distant machine. For example, the
php is interpreted by a server and returns
html code to the user. A language client (javascript) is directly interpreted on the post of the user.
|
Language sensitive to breakage |
A language sensitive to breakage is a language which makes differentiation between characters in uppercase letters and those in lower cases. So, a language sensitive to breakage will consider the following names as different: "
var, Var, VAR" while a language not sensitive to breakage will make no differentiation. By programming, it is therefore necessary to make sure to respect writing rules for the naming of the names of variables, of functions, classes...
To assure some one writing coherence within a programme, naming rules was set up. These rules play on the breakage of the name to establish a differentiation between a variable, a class, a method...
- variable: nomVariable
- constant: CONSTANT
- method: nomFonction ()
- class: NomClasse
A variable is a space in memory in which data (a number, of the text, a picture) are stocked. The contents of a variable evolve in the course of a programme ("it varies"). It the type of variable is specified (entirety,
booléan, puts snow chains on character) to be able to point out how is necessary to be interpreted information available in memo. Variables are an essential notion in coding.
It is a question here of defining what is called the range of a variable. Indeed, according to the site of code where is declared a variable, this one is not accessible of everywhere.
- Total variable: she is accessible in any point of the programme. She is generally defined at any beginning of programme to be available in any point of code. The use of total variables is proscribed for reasons of legibility and of service of code.
- Local variable: it has a limited range in the block including its statement. For example, a procedure, a class, a condition... When the block of instructions was carried out, variable is liberated (=détruite). The life of a local variable corresponds therefore exactly to that of its including block.
When parametres in a procedure are transmitted, these last can be transmitted by address (=référence) or by value. What is difference?
- By value: variable is during duplicated that it is transmitted in function. In other words, procedure works on a copy of variable (=une local variable for procedure). Modifications will not therefore be transmitted in the variable initially crossed in parametre.
- By address: contrary to passage by value, it is not a copy of variable that is transmitted but a gun-layer (=par classifies) towards this variable. This means that procedure works directly on variable. Any modification of variable in procedure returns therefore to change initial variable.
Native types (whole, real) generally passed by value because a copy in memory is not very fond of good food. Objects (authorities of classes) are in fact gun-layers. They are therefore directly transmitted by address because a copy (cloning) in memory would be too tiring.
When a variable is declared, this one is stocked in the random access memory of the computer in some site identified by an address. A gun-layer contains an address memo, in other words "he clocks in" towards data in memo. Work cost with the gun-layers therefore to be directly worked on variables in memory. The gun-layers are generally used when variables in procedures are transmitted to accomplish a passage by address (=par reference).
A
transtypage is the conversion of a variable of a type towards other one. For example, convert a
chaine of characters into number to perform a calculation. To program variables
transtypant systematically there is a guarantee of security to make sure which is well worked on the required type of data.
|
Method / Procedure / Function |
A procedure is group of instructions in which it is possible to give parametres. A function is a procedure which returns a value. For example, a procedure could throw the impression of a document while a function could turn the result of a mathematical operation.
A method indicates a procedure as well as a function but this term is generally used in an object programming context.
The object programming is a methodology structured to program. Rather than to turn to the coding of functionality (who evolve fast), orientated coding object leans on types of (generally fixed) data. She advocates the definition of structures composite of attributes (data) and of methods (functionality): classes. Objects will be concrete achievements of these classes which will be manipulated. Many notions
régissement the orientated coding object:
encapsulation, inheritance,
polymorphisme.
The attributes of a class must be accessible only through methods (generally
accesseurs get / jeu). Data are so concealed for the user, they are private in term object. This allows to bring some change in a class by adding data without the user's not have to change his code since he achieves attributes indirectly via
accesseurs.
A class can inherited from another class. In that case, the class girl (who inherits) has the same methods and attributes as the class mother. This allows to implement different specialisation levels by adding only functionality and more specific data in classes girls.
It is about the possibility of making inherit a class of several different classes. Numerous inheritance is to use with caution (C ++) since it poses problems of conflicts between names of methods and identical variables in different classes. The notion of interface is a clean alternative to accomplish a more complex inheritance.
It is about the possibility of defining methods of the same name but from which number of arguments or type differs. It is so possible to define different variants of the same method. It is the compiler with the load to cause method to use by comparing the number of arguments, types and the order of parametres. The
polymorphisme is very often used for the definition of the class constructors.
The realisation consists in writing the code of an empty method.
To re-define a method consists in implementing a method of the same name in a class girl while it already exists in the class mother. This allows to create more specific methods in a class to refine a functionality. For example, if the class mother "Screen" contains method "
afficherImage ()", the class daughter " EcranCouleur " who inherits from "Screen" can re-define method "
afficherImage ()" because she has additional functionality.
Surcharge consists in implementing an already existent method but with a number or types of different arguments. It is so possible to create different variants of the same method. The compiler will have the load to cause automatically method to use (according to criteria among parametres, types, in the order of arguments). For example, in the class " LecteurDVD ", it is possible to define different versions of method "
lancerFilm ()":
lancerFilm (TitreDuFilm),
lancerFilm (
realisateurFilm,
anneeFilm),
lancerFilm (
typeFilm,
anneeFilm,
acteursFilm).
A class can be assimilated with a structure composed of data (attributes) and functionality (methods). A class is a representation abstracted from a notion. An object will be concrete representation thanks to the mechanism of
instanciation. For example, the class "Nobody" has attributes (name, forename, age) and functionality (contact,
voirNom). The object "Stone" will be a case in point, authority of the class "Nobody".
An object is the concrete
réprésentation of one class. They say that an object is a class authority since it is one of the possible achievements. For example, the object "Ferrari" would be an authority of the class "Voiture ".
An abstract class is a class including at least an abstract method, that is to say a method without code (only its definition). It is impossible
to instancier a class abstracted to define with attributes (others than static) in this class. Classes girls who inherit from an abstract class absolutely have to implement abstract methods or declare themselves herself as abstract. Abstract methods allow to be sure that classes girls will have group of functionality (=méthodes abstract).
An interface is a class including only abstract methods. In other words, it is about a class without attributes (others than static) and composed only of methods without code (only definition). An interface can inherit from another interface. Every class implementing this interface must implement each of methods. Interfaces allow to give common functionality with different classes. These classes are so united under the same type.
An element is static when he can be used without passing by an authority of class (=objet). In other words, they achieve a method or a variable by using directly the class name. A static element does not depend on an object, it is only linked to the class. It is possible to use a static variable to count the number of
instanciés objects, give class constants...
|
Access rights / Visibility |
Access rights allow to define the range of a variable, of a method, of a class. Generally 4 markers are considered:
- Public: the element is accessible directly in any point of code.
- Private: the class is accessible in its package, available variable / method only in the class where she defines.
- Protegé: variable / method is accessible in its package and the stemming classes.
- Package: variable / method is available in the stemming classes.
Let us take as the model of a class mother M and of a class girl F who inherits from Mr
- Upcasting: or o, an object of type M authority of F. In the writing of code, o He am considered of type Mr has therefore only the functionality of the class mother. It is in execution that o will be considered of type F (=liaison dynamics in popular dance). Objects are managed so on the whole by considering them of the type of the class mother in the writing of code.
- Downcasting: from example above, if they want to use the functionality of the class girl, it is necessary to make a cast on o in type F.
An exception is an event launched by the programme when he meets an error of known execution (division by zero, index out of the picture). It is possible to treat this event to correct it or to let it spread between methods (to postpone its treatment). If exception attains the main method of the programme ("hand ") without being treated, it is the
plantage!
An
accesseur is a method which serves traditionally for "achieving " data deprived of a class according to the principle of the
encapsulation. They name generally
a getAttribut method serving for turning the value of a field and
they setAttribut that affecting a value. The user achieves data so via
accesseurs what allows to bring some change in its code without changing the way to achieve data.
A constructor is one particular method which serves for creating an object authority of a class. It is about the process by which a concrete object from an abstract structure is generated. A constructor is generally called
new in languages.
Contrary to the constructor who creates an object class authority, the destroyer is a method liberating the object of memory.