Programming:
What is functional programming?Functional programmingis a style of programming that emphasizes the evaluation of expressions rather than the execution of commands. This means that a program, written in a functional programming language, consists of a set function definitions and an expression, whose value is output as the program’s result. There are no side results (like an assignment) to expression evaluation, so an expression will always evaluate to the same value, if its evaluation terminates.Referential transparencyPure functional languages achieve referential transparency by forbidding assignment to global variables. Each expression is a constant or a function application whose evaluation has no side effect, it only returns a value and that value depends only on the definition of the function and the values of its arguments.What is modular programmingA module, in modular programming, is a series of functions (or procedures) that are related in some way. This way of programming is used in many applications.
2Way of workGiven a problem, you begin with analysis of the problem. You carefully look at the requirements of the problem and you make sure all questions are answered before you begin with design of the modules. Then, you break the problem in sub problems. Each of these problems you solve in one or more modules. All the modules together solve the complete problem. Modules itself may be divided into smaller modules.A module is a set of functions (actions, see chapter two) that are related to each other. For example, a module called “Driving” contains the functions drive(brand_of_car),accelerate(speed)andstop(). Amodulair program is always more clearly than a pure functional program because the different modules are classified on base of relevance.What is OOP?Object Oriented Programming (or OOP) is a revolutionary concept that changed the rules in computer program development. OOP is organized around objects rather than actions. Normally, a program has a simple flow: input data, process the data and output a result. OOP has a different view; what we really care about are the objects we want to manipulate, not the logic required to manipulate them. Examples of such objects can be human beings (for example, described by name, address and so on), or buildings and floors (whose properties can be described and managed) or even little things, like a button or a toolbar.Object Oriented Programming is an alternative to modular programming. The design technique associated with OOP is Object Oriented Design. In an object oriented program, the modules are classes rather then procedures. A class is a collection of objects.Objects As said, OOP is all about objects. An object is actually a container filled with information. You can see an object as a black box, which sends and receives messages. A black box, or object,
3containscodeanddata. Code are sequences of computer instructions, and data is information on which the instructions operate. In C ++ units code are called functionsand units of data are called structures. Functions and structures are not connected to each other. For example, a function can operate on more than one structure, and a structure can be used in more than one function.A structure can be public data, these can be accessed by another object. An object can also contain private data. This data can only be accessed by the object itself, and not by another object. The private data is implemented so that an outstanding object cannot modify data while it’s not necessary or data that is not supposed to be modified.Messages All the communication between objects, is done by messages. An object sends, but also receives messages. The object, to which the message is sent, is there ceiverof the message. Messages define the interface of the object. At least everything an object can do is represented by his messages. Actually, an object usually can do more, because an object also can have private functions.Normally, messaging is done between the objects. One object receives a message from an other object, and sends a message back to the same, or to an other object.Information hiding Providing access to an object by sending and receiving messages, while keeping the details of the object private, is called information hiding. Another word, which means the same, is incapsulation.<a name=”_Toc473031126″> Information hiding is a good thing; one object should only know that things about another object that are relevant. Make members in an object private or protected when possible.