background preloader

Programming Paradigms

Facebook Twitter

Programming paradigm. Data-driven programming. Data-driven design. Active object. The pattern consists of six elements:[3] See also[edit] References[edit] Jump up ^ Douglas C.

Active object

Schmidt; Michael Stal; Hans Rohnert; Frank Buschmann (2000). Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects. Meemoo project by Forrest Oliphant. Semantic-oriented programming. Common features[edit] The way of how these semantic information are represented in the system vary according to the approach chosen (see below), common to these approaches are the following features: Goals[edit] The goals of SOP are: Improving the maintainability of a softwareImproving the transparency of a softwareFlexibility by allowing exchangeability of logic and/or implementationOptimal support for agile development processes (refactoring) SOPlets[edit] Soplets is a method of describing semantic concepts as blocks of code, using existing features of the (Java) language, namely annotations and enumerations.

Semantic-oriented programming

Soplets can be referenced and used from anywhere inside the code. A Soplet may be enhanced by one or more (stateless) functions, which are directly attached to the code block.

FLOW BASED PROGRAMMING

Object-oriented programming. Overview[edit] Rather than structure programs as code and data, an object-oriented system integrates the two using the concept of an "object".

Object-oriented programming

An object has state (data) and behavior (code). Objects correspond to things found in the real world. So for example, a graphics program will have objects such as circle, square, menu. An online shopping system will have objects such as shopping cart, customer, product. Object-oriented design. Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.

Object-oriented design

It is one approach to software design. Overview[edit] What follows is a description of the class-based subset of object-oriented design, which does not include object prototype-based approaches where objects are not typically obtained by instancing classes but by cloning other (prototype) objects. Responsibility-driven design. Responsibility-driven design is a design technique in object-oriented programming.

Responsibility-driven design

It was proposed by Rebecca Wirfs-Brock and Brian Wilkerson, who defined it as follows: Responsibility-driven design is inspired by the client/server model. It focuses on the contract by asking:What actions is this object responsible for? What information does this object share? Logic programming. Logic programming is a programming paradigm based on formal logic.

Logic programming

Programs written in a logical programming language are sets of logical sentences, expressing facts and rules about some problem domain. Together with an inference algorithm, they form a program. Major logic programming languages include Prolog and Datalog. A form of logical sentences commonly found in logic programming, but not exclusively, is the Horn clause. An example is: Imperative programming. The term is used in opposition to declarative programming, which expresses what the program should accomplish without prescribing how to do it in terms of sequences of actions to be taken.

Imperative programming

Functional and logic programming are examples of a more declarative approach. Imperative, procedural, and declarative programming[edit] Event-driven programming. Event handlers[edit] A trivial event handler[edit] Because the code for checking for events and the main loop do not depend on the application, many programming frameworks take care of their implementation and expect the user to provide only the code for the event handlers.

Event-driven programming

In this simple example there may be a call to an event handler called OnKeyEnter() that includes an argument with a string of characters, corresponding to what the user typed before hitting the ENTER key. To add two numbers, storage outside the event handler must be used. Event loop. When the event loop forms the central control flow construct of a program, as it often does, it may be termed the main loop or main event loop.

Event loop

This title is appropriate because such an event loop is at the highest level of control within the program. Message passing[edit] Alternative designs[edit] This approach is in contrast to a number of other alternatives: Structured programming. It emerged in the 1960s—particularly from work by Böhm and Jacopini,[1] and a famous letter, Go To Statement Considered Harmful, from Edsger Dijkstra in 1968[2]—and was bolstered theoretically by the structured program theorem, and practically by the emergence of languages such as ALGOL with suitably rich control structures.

Structured programming

Low-level structured programming[edit] At a low level, structured programs are often composed of simple, hierarchical program flow structures. These are sequence, selection, and repetition: Graphical representations of the three basic patterns. The box diagrams (blue) were invented right for the new theory, and you can see here their equivalents in the mostly used control flow charts. Procedural programming. Procedures and modularity[edit] Scoping is another technique that helps keep procedures strongly modular. It prevents the procedure from accessing the variables of other procedures (and vice-versa), including previous instances of itself, without explicit authorization. Because of the ability to specify a simple interface, to be self-contained, and to be reused, procedures are a convenient vehicle for making pieces of code written by different people or different groups, including through programming libraries.

Functional programming.

Prototyping & Testing