CSC/ECE 517 Fall 2012/Table Of Contents: Difference between revisions
(→Ruby) |
(→Ruby) |
||
Line 58: | Line 58: | ||
A method that belongs to a class is called by creating an object of the class and passing the method name to the object as a message. The object then looks up the [http://www.madebydna.com/all/code/2011/06/24/eigenclasses-demystified.html method lookup path] and tries to match the called method with the defined methods in the class. On success, the method is executed and the result is returned. | A method that belongs to a class is called by creating an object of the class and passing the method name to the object as a message. The object then looks up the [http://www.madebydna.com/all/code/2011/06/24/eigenclasses-demystified.html method lookup path] and tries to match the called method with the defined methods in the class. On success, the method is executed and the result is returned. | ||
If the object does not find a match in its method lookup, in normal circumstances the [http://www.ruby-doc.org/core-1.9.3/NoMethodError.html NoMethodError Exception] is raised . | If the object does not find a match in its method lookup, in normal circumstances the [http://www.ruby-doc.org/core-1.9.3/NoMethodError.html NoMethodError Exception] is raised . | ||
In cases where the user wants to handle the methods which are not defined but are still called, “method_missing” can be defined and the user can handle the methods as he/she sees fit. [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Format_for_Defining_method_missing Here] is the format for method missing | In cases where the user wants to handle the methods which are not defined but are still called, “method_missing” can be defined and the user can handle the methods as he/she sees fit. [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Format_for_Defining_method_missing Here] is the format for method missing and Ruby method look up flow. | ||
Examples of method missing are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Examples here]. | |||
Advantages and disadvantages of method missing are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Advantages_of_method_missing here]. | |||
Method missing, one of the dynamic features of Ruby, is not a feature that is unique to Ruby. It exists in Smalltalk, Python, Groovy, some Javascripts and most CLOS (Common Lisp Object System)extensions. In this section we look at the few such similar implementations in other languages. The table [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Similar_functionality_in_other_languages here] gives different ways the functionality related to method_missing is handled in other languages.<ref>http://olabini.com/blog/2010/04/patterns-of-method-missing/</ref> | |||
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w22_an#Patterns_of_method_missing.5B9.5D Here] are few patterns of method missing. | |||
Revision as of 00:46, 12 November 2012
Introduction
This wiki page will give you the outline of the topics from Wiki 1a and 1b. A brief introduction to the topics covered(in 1a and 1b) and the links to the appropriate topic is available on this page.
Object Oriented Programming
Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. An introduction to Object Oriented Programming and its primary concepts like abstraction,polymorphism,encapsulation and inheritance are explained here.Features and advantages of Object oriented programming is given here. Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming decomposes a problem into a set of functions.It is the opposite of object oriented Programming. Advantages of functional programming are given here. We can perform functional programming on an object-oriented programming language because of the following reasons:
- Object can have constant state.
- Method can depend only on its arguments and context available at method definition time.
Combining both of these paradigms will not only provide us a robust design structure, but also will enable the programmers to develop solutions to complex problems quickly and effectively.More details can be found here.
Some of the basic features of Functional Programming which can be combined with Object Oriented paradigm are:
A number of programming languages support mixing of both functional and object-oriented code. Three of these (Scala, Ruby, and Conjure), are described in more detail here.
Multiple Inheritance is one of the features of a few Object-oriented (OO) languages in which a class inherits properties (variables & methods) from more than one parent class . The former is called a sub or child class and the latter is called a super class or ancestor class. Here are the usage guidelines of multiple inheritance.A real world example of multiple inheritance is given here. C++ supports multiple inheritance. A detailed explantion is given here. JAVA doesn't support multiple inheritance but with the use of the concept called interface, multiple inheritance can be simulated. A more detailed explanation is available here. Ruby doesn't support multiple inheritance but provides a similar feature using modules and mixins. Advantages of Mixins are given here. Object oriented languages support inheritance through different mechanisms. Methods from parent classes can be re-implemented in child classes to improve the behavior of the child class without having to re-write the whole class or define a completely new method. As method re-implementation in descendant classes is achieved differently in different classes it is crucial to understand these mechanisms. A brief explanation of Multiple inheritance in Scala and Python is given here. Advantages and disadvantages of Multiple inheritance are given here. Because of few drawbacks(which are discussed above), few languages have implemented concepts like Modules and Mixins to emulate the power of multiple inheritance. Multiple Inheritance is supported by several object oriented languages such as C++, Ruby, Perl, Python etc.Implementation of multiple inheritance in each of these languages is compared here.
The Object-Oriented programming paradigm has two ways for specifying objects,Set based language - object specification and Protocol based language - object specification.
Ruby
Ruby is a dynamic, reflective, object oriented programming language which was first developed in mid 90s by Yukihiro "Matz" Matsumoto in Japan.[1]. It is a cross plat-form interpreted and object-oriented language. It is designed for the principle of least surprise. Matz says "I wanted to minimize my frustration during programming, so I want to minimize my effort in programming. That was my primary goal in designing Ruby. I want to have fun in programming myself. After releasing Ruby and many people around the world got to know Ruby, they said they feel the way I feel. They came up with the phrase the principle of least surprise."[2] In 2004, web application framework of Ruby "Ruby on Rails" was introduced by David Heinemeier Hansson. With increased complexity of codes, it became essential to design a development environment which will include some intelligence in code writing with increased version control and simpler debugging. Popular IDEs for Ruby are RadRails,Netbeans,Textmate,Rubymine,jRuby and RDT. A brief outline is given on objects,classes and inheritance.Ruby can act as a set-based language and prototype-based language.
A Method is a Subroutine (or Procedure or Function) in a class that defines the behaviour exhibited by the associated Class instances at runtime. Methods defined within a Class are bound to the class either by Static binding or Dynamic binding. An example of a method in Ruby is given here.Instance methods,static methods,accessor methods are different kinds of methods. A closure is basically a method/function that has the following two properties:
- We can pass it around like an object (to be called later)
- It remembers the values of all the variables that were in scope<ref>http://en.wikipedia.org/wiki/Scope_(computer_science)</ref> when the function was created. It is then able to access those variables when it is called even though they may no longer be in scope.Closures must be explicitly supported by the language. In order for the language to be able to support closures, it must support first-class functions.
A normal function is defined in a particular scope (i.e. in a class) and can only be called within that scope. This function has access to all the variables in the scope that it is defined, like the parameters that are passed into it as well as class variables. A closure on the other hand may be defined in one scope and be called in a completely different scope (since we can pass it around before calling it). Because of this, when a closure is created, it retains the values of all the variables that were in scope when the closure was defined. Even if the variables are generally no longer in scope when the closure is called, within the closure they still are. In other words, the closure retains knowledge of its lexical environment at the time it was defined. Examples of closures are given here. Instance variables in ruby are defined.Advantages of closures are given here. Class variables and class methods in Ruby are defined here.The basic syntax to declare them as class variables and instance variables is also given. Ruby Modules are similar to classes in that they hold a collection of methods,constants and other module and class definitions.Modules definition is similar to classes just that we use the keyword module instead of the class keyword.Unlike classes, objects cannot be created based on modules nor can it be sub classed.However, it can be specified that the functionality of one module should be added to another class, or a specific object. Uses and examples of modules are given here. The most interesting fact about the use of modules is to define mixins. When a module is included within a class,all its functionality becomes available to the class.Modules can contain class methods and instance methods. Mixins are different from #include and multiple inheritance and this is demonstrated here. More about Mixins can be found here.
A method that belongs to a class is called by creating an object of the class and passing the method name to the object as a message. The object then looks up the method lookup path and tries to match the called method with the defined methods in the class. On success, the method is executed and the result is returned. If the object does not find a match in its method lookup, in normal circumstances the NoMethodError Exception is raised . In cases where the user wants to handle the methods which are not defined but are still called, “method_missing” can be defined and the user can handle the methods as he/she sees fit. Here is the format for method missing and Ruby method look up flow. Examples of method missing are given here. Advantages and disadvantages of method missing are given here. Method missing, one of the dynamic features of Ruby, is not a feature that is unique to Ruby. It exists in Smalltalk, Python, Groovy, some Javascripts and most CLOS (Common Lisp Object System)extensions. In this section we look at the few such similar implementations in other languages. The table here gives different ways the functionality related to method_missing is handled in other languages.<ref>http://olabini.com/blog/2010/04/patterns-of-method-missing/</ref> Here are few patterns of method missing.
Namespace in C++ is similar to modulesIn general, a namespace is a container for a set of identifiers (names), and allows the disambiguation of homonym identifiers residing in different namespaces.Namespace usually group names based on their functionality. Usage of namespaces and its example is given here.
Multiple inheritance in C++ similar to mixins.You can derive a class from any number of base classes. Deriving a class from more than one direct base class is called multiple inheritance. An example is given here.
Interfaces in JAVA is similar to mixins.A Java interface defines a set of methods but does not implement them.A class that implements the interface agrees to implement all of the methods defined in the interface, thereby agreeing to certain behavior, thereby implementing multiple inheritance.
Properties of an interface are:
- An interface is implicitly abstract. You do not need to use the abstract keyword when declaring an interface.
- Each method in an interface is also implicitly abstract, so the abstract keyword is not needed.
- Methods in an interface are implicitly public.
An example is given over here.Comparison between mixins and interfaces and given here. Comparable and Enumerable are commonly used mixins.
Ruby has simplified the way programmers use loops and iterators. Ruby helps programmers to use Don't Repeat Yourself (DRY) principle effectively by using blocks and defining iterators over collections.<ref name="Iterators">Alan Skorkin. "A wealth of ruby loops and iterators" http://www.skorks.com/2009/09/a-wealth-of-ruby-loops-and-iterators</ref> This helps in minimizing the development work that programmers often find in any other O-O style programming language. In ruby, these iterators, blocks and functional idioms are explained as:
Iterators are Collection defined methods that helps to iterate over all the elements present in a Collection.<ref name ="tutorial_point_i">"Ruby Iterators" http://www.tutorialspoint.com/ruby/ruby_iterators.htm</ref> Ruby Collections are basically objects that store a group of data members of various types. Examples of Collection are arrays, hashes etc.
A block consists of chunks of codes with a name assigned to it.<ref name="blocks">"Ruby blocks" http://www.tutorialspoint.com/ruby/ruby_blocks.htm</ref> For example,
my_block { puts "Hello World" }
Different types of iterators in Ruby are times iterator,upto iterator,step iterator,each iterator,collect iterator,map iterator. Ruby allows programmers to define their own iterator other than the iterators listed above. For example if a programmer wishes to define an iterator which prints an array in reverse order, then he can do so as shown here. Blocks are the most commonly used form of closures in Ruby. We can find them all over the core Ruby libraries. They are nameless functions and can be passed anywhere.A Block consists of a chunk of codes with a name assigned to it.Alternately, a block is a code which is passed to the iterator. These blocks can either be defined by enclosing them in curly braces or by using the do...end syntax as shown here. Procs are nameless block of code that can be represented as an object and can be passed around or called at will.Lambdas are a more strict form of proc.
Multiple Inheritance has several disadvantages that can lead to ambiguous code behavior either during compile time or run time.Ruby does not support directMultiple Inheritance. But, Multiple Inheritance can be achieved in Ruby through Modules. Modules simulate multiple inheritance in Ruby.Given here is the Taggable-string example taken from the Class notes of CSC517, NCSU. Suppose we want to add tags to Strings, we can define a Taggable module and include it into the class. Multiple inheritance may cause name conflicts when a sub-class inherits different super-classes that contain the methods or variables with the same name. This can be resolved in many ways. Advantages and disadvantages of multiple inheritance are given here.
Expression orientation<ref name="saas_video">"SaaS. 3.6 - Ruby Blocks, Iterators, Functional Idioms " http://www.youtube.com/watch?v=bRn91_Zonh4</ref> in ruby refers to the mechanism of applying a series of operation on collections ( e.g. arrays, hashes etc ) without actually modifying the original collection. For example, consider the sort method in ruby. The sort method when called on an array creates a temporary array having the same elements as that of the original array. It then sorts this temporary array and returns that.
Functional idioms refers to the various constructs in ruby that mimics [Functional Programming Language Functional Programming Language. Most programmers argue that Ruby is actually an Object Oriented Programming Language and it does not behaves as per the functional programming paradigm.
Regular expressions are extremely powerful.Rubywas built as a better Perl hence it supports regular expressions.Regular expression is sort of a string used to match to other strings.In ruby regular expressions are written in the format /pattern/modifiers where pattern is the regular expression and modifiers are the series of characters specifying the various options. More on regular expressions can be found here.
Redirection refers to redirection of incoming request from one page to another. HTTP is stateless, hence redirection with session/flash makes it stateful.As the http requests are stateless,it leads to losing the state of the previous request. Thus Rails provides hash called Flash which persist until the end of the next request received and Session hash, which unlike flash persists forever. The working,example,advantages and disadvantages of flash/session is given here.
Model-View-Controller
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding. This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.
The Model-View-Controller MVC pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:
* Model: The model manages the behavior and data of the application domain. It responds to requests for the user interface(view),and responds to instructions from the controller to change state. * View: The view refers to the user interface and manages the display of information * Controller: The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.
A brief history and research about MVC architecture is given here.
The classical MVC concept is more suited for desktop applications than typical web applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In web applications the HTML for a complete screen is sent to the browser. The user actions in the UI are sent to the web server in the form of a request. This request has to be interpreted and normally the new or updated screen has to be sent to the browser again. The HTML for the complete screen can be understood as a set of widgets (or subviews). For example it can contain a "main menu", a "news list", a "basket" etc. The web server always needs to generate the complete view with all its subviews. The working of MVC framework in web application development is given here. Recently MVC has become a very popular strategy for building websites. There are quite a few programming languages for which the MVC-Web framework is now available. Struts for Java, Maypole for Perl and Rails for Ruby are some to name a few. A brief introduction of the MVC pattern in Ruby on Rails and Struts is given here. Spring framework and Java Server Faces are two examples of MVC pattern. Advantages and disadvantages of MVC pattern is given here.
Code Reuse
Code reuse, also known as software reuse is the practice of using the same segment of code in multiple applications. The definition, overview and a brief history of code reuse is found here. There are several techniques in code reuse. Code can be reused by using simple coding. For example, using a single line of code, we can reuse the code.Procedures and macros are the low level code reuse techniques.Methods can be used in code reuse, a method can be defined and declared multiple times wherever required. An individual software component is a software package, a Web service, or a module that encapsulates a set of related functions. All system processes are placed into separate components so that all of the data and functions inside each component are semantically related. Because of this principle, it is often said that components are modular and cohesive. With the help of Packages,modules and inheritance, we can achieve code reuse. Generators,Software architectures, code scavenging, Transformational systems, Very High Level Languages (VHLL) are more techniques of code reuse. Here are some of the best practices to be followed to make sure that the code that is being written is reusable. Advantages and disadvantages of code reuse can be found here. Here are few of the tradeoffs for code reuse at various levels of components.
Scaffolding
Scaffold is a temporary platform, either supported from below or suspended from above, on which workers sit or stand when performing tasks at heights above the ground. Because of its nature of its use, it must made sure that it is properly constructed and ensures the safety of those who use it. Deriving from the analogy above, scaffolding in web application framework refers to providing a minimal setup for various components that make a web application. These components include but are not limited to databases, application servers and web servers. Such scaffolds are generally standard, bare minimal and reusable components that are automatically generated.
A typical web application contains a database layer for retrieval and storage of information. The basic operations performed to access the database are grouped into the following types, which are commonly referred to as the CRUD functionality.
Create Read Update Delete
A scaffold for web application will typically provide stubs for performing the above mentioned CRUD functions. This boilerplate code provides the essential infrastructure to develop a web application in quick time.
MVC framework is a popular web application framework that separates concerns and applications into model, view and controllers. In MVC, scaffolding will usually create basic model, views and controllers and also the database objects needed. The origin and evolution of scaffolding is given here. Scaffolding in MVC based web frameworks is given here. Apache Tapestry is an open-source framework for creating dynamic, robust, highly scalable web applications in Java. Tapestry complements and builds upon the standard Java Servlet API, and so it works in any servlet container or application server. Tapestry includes some scaffolding components that generate code at runtime thus allowing an application to be dynamically assembled at runtime. The two main scaffolding components are
BeanEditForm - A component that creates an entire form editing the properties of a particular bean. It generates a simple UI for editing the properties of a JavaBean, with the flavor of UI for each property (text field, checkbox, drop down list) determined from the property type (or by other means, such as an annotation), and the order and validation for the properties determined from annotations on the property's getter and setter methods. Grid - A grid presents tabular data. It is a composite component, created in terms of several sub-components. The sub-components are statically wired to the Grid, as it provides access to the data and other models that they need. A Grid may operate inside a form.
Reflection
Reflection is a relatively common computer programming concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation. Precisely, "Reflection" can be defined as a language's ability to inspect and dynamically call classes, methods, attributes, etc. at runtime. More advanced uses of reflection let you list and call methods, constructors, etc. A little more introduction about reflection is found here. There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can implemented with the implementation of the following components:
- Ability to create first class objects ie reification.
- Ability to convert a string that denotes a class or a method into its corresponding reference or invocation.
- Ability to use and create symbolic links to methods and classes.
There are two basic types of reflection. They are:
Features,advantages,disadvantages of reflection in C#,JAVA,Ruby,Smalltalk,PHP is given [expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_ar#Structural_Reflection here]. Applications of reflection are given here. Comparison of reflection in different languages is given here. Advantages and disadvantages of reflection are given here.
CRC Cards
CRC Cards, also known as Class-Responsibility-Collaboration cards are a brainstorming tool to enable collaboration across different teams or individuals in contribution to design, usually used in Object Oriented Software development. This was proposed by Ward Cunningham and Kent Beck[3]. The CRC card can be viewed as an index card, with the following details:
- The Top of the card usually bears the name of the class.
- The Left side of the card has the responsibilities of the class.
- The Right side of the card has the collaborating classes corresponding to each of the responsibilities listed in the left side.
Thus in general, a CRC session can be viewed as the interaction between a set of collaborating classes for a particular Use case.
According to [4]A CRC session proceeds with someone simulating the system by talking about which objects send messages to other objects. By stepping through the process' weaknesses and problems are easily uncovered. Design alternatives can be explored quickly by simulating the design being proposed.
A CRC Example
To better understand how the CRC cards work together, let us consider a simple student enrollment problem,where we are required to model the students enrolled in different courses. We can easily define the Student CRC Card as having attributes such as student name, student id and responsibilities that enable a student to enroll in a course or drop the course. In this particular instance, the collaborating class would be the Course class. The Course CRC Card can in turn be visualized as having its own responsibilities, such as having attributes like Course id, course name and the collaborating class would be the Instructor
class. The CRC cards for the Student class and the Course Class are shown below.
There are also several practical designs that use the CRC card model to design Object oriented software design. The Simulator for Coffee Maker explores an Extreme Programming approach combined with CRC card technique to come up with a design for the coffee maker.
Another interesting approach using CRC cards is the design for the ATM Machine
Advantages of CRC cards
There are a few advantages of CRC cards that make it a preferable model in many designs. Some of the advantages of the CRC card design method are
- CRC cards can allow designers to easily make audience understand a very complex system. In essence it allows for building more complex designs by slowly building the interactions between the collaborating classes, one by one.
- CRC cards are a simple technique and it can be easily used by anyone with very little training and does not require any expensive computing resources(a board or a paper and a pen would suffice).
- CRC is fundamentally a brainstorming tool, enabling different people in a team to come up with the design by collaborating, enabling everyone in the team to contribute
- CRC can be used with other formal object oriented design methodologies such as Extreme Programming (an Agile development Technique) and can be used along with modeling languages such as Unified Modeling Language(UML)
An example of CRC cards is given here.
There are a few advantages of CRC cards that make it a preferable model in many designs. Some of the advantages of the CRC card design method are
- CRC cards can allow designers to easily make audience understand a very complex system. In essence it allows for building more complex designs by slowly building the interactions between the collaborating classes, one by one.
- CRC cards are a simple technique and it can be easily used by anyone with very little training and does not require any expensive computing resources(a board or a paper and a pen would suffice).
- CRC is fundamentally a brainstorming tool, enabling different people in a team to come up with the design by collaborating, enabling everyone in the team to contribute
- CRC can be used with other formal object oriented design methodologies such as Extreme Programming (an Agile development Technique) and can be used along with modeling languages such as Unified Modeling Language(UML)
CRC cards have limited scope. If we go about designing a huge project, the scope may span many classes and there might be numerous interactions between them. The tedious task here is to maintain the CRC cards and formulate appropriate interaction between them. We need software for CRC Cards for these reasons.Here are the steps for designing software for CRC cards. Software Development Life Cycles are different for a standard development process and for Object Oriented development. This difference needs to be understood in order to know how to meet the benchmarks set for the project. There are multiple processes that are used in software development, the most common ones in use being Waterfall model and Spiral model. The Waterfall model is progression based and the Spiral model is iterative. We need to understand that the uniqueness of Object Oriented SDLCs comes from the fact that it is more user centric as compared to standard SDLCs that are more system centric. We will now see which models work for Object Oriented SDLCs (OO SDLCs) and which don’t. CRC cards play a very important role in an Object Oriented SDLC. Thus, figuring out which models work well for OO SDLCs will result in understanding which models use CRC cards and why. The strength of OO model depends on the idea that, here, design and deployment come together. In the case of a spiral model, this works to make the spiral tighter. Since the waterfall model places over importance on deliverables and user involvement is minimal, which is one of the key focuses of OO SLDCs using CRC cards, the model is considered ineffective. The Spiral model involves multiple revisions of the same idea. When a set of cards have been developed, it would make sense to refine the idea presented in the card but not to redefine them over and over, which may be the case. This does not serve the purpose of actually convening a CRC discussion among the team to draw up cards corresponding to the user requirement. Moreover, in the case of the Spiral model, we would need to convene multiple such meetings at each iteration, which would drastically bring down the overall productivity of the team. CRC cards are used widely for software development processes. More about this can be found here.
Version Control System
A version control system (VCS) is a process for managing software codes,files and directory structures and corresponding updates made to them during software development, web development etc. project or during subsequent project maintenances. Version control is also known as revision control, source control or software configuration management (SCM)[6]. Any software development project is a dynamic and fast paced environment. In a typical setting, development for a project is performed simultaneously by many developers. Thus, incorporating all the changes made, either simultaneously or at different times, poses a new type of challenge. The need of version control systems is given here. VCS' can be broadly categorized into three groups based on the repository model:
References
http://en.wikipedia.org/wiki/Component-based_software_engineering http://en.wikipedia.org/wiki/Functional_programming http://docs.python.org/dev/howto/functional.html http://searchsoa.techtarget.com/definition/object-oriented-programming