CSC/ECE 517 Fall 2012/Table Of Contents: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(93 intermediate revisions by the same user not shown)
Line 3: Line 3:
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.
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 in Ruby=
==Object Oriented Design (OOD)==
 
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is a methodology to develop a solution by creating structured objects which interact with each other through well defined interfaces. The object interaction involves invocation of required services and exchange of corresponding data. An object contains data and set of methods or procedures which act on that data. Access to data can be controlled based on access specifiers. The input to the problem is passed to the object through method invocations which are defined by the interfaces. Interfaces define the procedure name and the parameters. The object implements the methods of the  interfaces and also encapsulate data needed for solving the problem which can include instances of other objects.
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#An_example_of_Object_Oriented_Design Here] is an example of Object Oriented Design.
Advantages of Object Oriented Design:
* Code Reusablility<br>
* Real-World Modeling<br>
* Robustness and Reliability<br>
* Less Maintenance<br>
 
Traits of a poor Object Oriented Design are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Traits_of_a_poor_Object_Oriented_Design here].
 
Little about Software success and Software failure is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Software_success_and_failure here].
 
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:
*[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation]
*[http://en.wikipedia.org/wiki/Abstraction Abstraction]
*[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance]
*[http://en.wikipedia.org/wiki/Interface_(Java) Interface]
*[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism]
 
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:
*[http://en.wikipedia.org/wiki/Reusability Re-usability]
*[http://en.wikipedia.org/wiki/Privacy_software Privacy]
*[http://en.wikipedia.org/wiki/Software_documentation Documentation]
 
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:
*[http://en.wikipedia.org/wiki/Reusability Re-usability]
*[http://en.wikipedia.org/wiki/Privacy_software Privacy]
*[http://en.wikipedia.org/wiki/Software_documentation Documentation]
 
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan & Plauger
At the heart of great design are a set of principles and patterns.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Design_principles Design principles] form the foundation of good object-oriented design and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Design_patterns design patterns] provide general repeatable solutions for common software problems.
 
Essential [http://en.wikipedia.org/wiki/Use_case use cases] are abstrat, lightweight, technology-free dialogues of user intension and system responsibility, that effectively capture requirements for design of a system. Working with essential use cases yeilds further benefits: analysts can take advantage of recurring patterns in essential use cases and the crucial common vocabulary of responsibilities lets designers trace directly from the essential use cases to the objects in their design.
 
There are some tips that can be used in designing to enhance and improve the object-oriented projects:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Tips_for_a_good_OOD Use Lots of Objects]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Tips_for_a_good_OOD Use Interfaces to Make APIs Predictable]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Tips_for_a_good_OOD Use Dependency Injection]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Tips_for_a_good_OOD Create Loosely Coupled Classes]
 
Factors leading to Poor OOD are:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Violating_the_Single_Responsibility_Principle_.28SRP.29 Violating the Single Responsibility Principle]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Violating_the_Don.27t_Repeat_Yourself_principle_.28DRY.29 Violating the Don't Repeat Yourself Principle]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Overuse_of_Inheritance Overuse of Inheritance]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Software_design_anti-patterns Software design anti-patterns]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Object_oriented_design_anti-patterns Object oriented design anti-patterns]
 
One of the major causes of limited success in adopting object-oriented methodologies is the failure of management and design teams to recognize and plan for the scope of this change. If preventive measure are taken software failure can be avoided and organizations can benefit from OOD. Assessing quality of software at the design level will provide ease and higher accuracy for users.Some of the methods are listed below:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Identifying_Code_Smells Identifying Code Smells]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#MOOD_.28Metrics_for_Object_Oriented_Design.29 MOOD (Metrics for Object Oriented Design)]
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w44_as#Well-Known_Software_Failures Here] are some well
known software failures.
 
==Object Oriented Programming==


[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Object-oriented_Programming ''Object-oriented programming (OOP)''] is a programming language model organized around "objects" rather than "actions" and data rather than logic.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Object-oriented_Programming ''Object-oriented programming (OOP)''] is a programming language model organized around "objects" rather than "actions" and data rather than logic.
Ruby is a dynamic, reflective, general-purpose object-oriented programming language.Ruby is all about objects.
An introduction to Object Oriented Programming and its primary concepts like abstraction,polymorphism,encapsulation and inheritance are explained [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#What_is_Object_Oriented_Programming.3F here].Features and advantages of Object oriented programming is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Features_of_Object-oriented_Programming here].
An introduction to Object Oriented Programming and its primary concepts like abstraction,polymorphism,encapsulation and inheritance are explained [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#What_is_Object_Oriented_Programming.3F here]. It mainly explains Object Oriented Programming in Ruby. A brief outline is given on [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Object objects],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Class classes] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Inheritance inheritance.Features and advantages of Object oriented programming is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Features_of_Object-oriented_Programming here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Instance_Variables Instance variables] in ruby are defined.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Instance_Methods Instance methods] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Accessor_Methods Accessor methods] are explained briefly along with examples.
Class variables and class methods in Ruby are defined [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Class_Variables_and_Class_Methods here].The basic syntax to declare them as class variables and instance variables is also given.
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Functional_Programming 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.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Functional_Programming 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Advantages_of_Functional_Programming here].
Advantages of functional programming are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Advantages_of_Functional_Programming here].
Line 25: Line 79:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Pattern_Matching Powerful pattern matching]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Pattern_Matching Powerful pattern matching]


Ruby is a dynamic, reflective, general-purpose object-oriented programming language.Ruby is all about objects.
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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Examples_of_Mixing here].
 
 
In any programming language, the [http://en.wikipedia.org/wiki/Data_type data type] refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.
 
The [http://en.wikipedia.org/wiki/Primitive_data_type primitive data types] refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.
 
The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.
* Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc.
* Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.
* Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.
* Strings - Strings represent the sequences of characters or simply any text, e.g. "Hello!", "9 am to 6 pm", etc.
* Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.
 
Many [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming] languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.
 
Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).
 
Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.
 
Primitive objects in different OO languages like C++,JAVA,C#,JavaScript,Ruby are explained [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Primitive_objects_in_different_OO_languages here].
 
Advantages of using primitive data types are:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Efficiency efficiency]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Simplicity simplicity].
 
Disadvantages of using primitive data types are:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Lack_of_inheritance_capability lack of inheritance capability]*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Not_Scalable not scalable]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Utility_Functions Utility functions]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Null_Values Null values]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w21_aa#Unexpected_results_due_to_method_overriding Unexpected results due to method overriding].
 
Subclassing is a principle of creating a specialization(subclass/ [http://msdn.microsoft.com/en-us/library/chsw0hdc.aspx]) of a [http://www.webopedia.com/TERM/B/base_class.html base class](superclass/ parent class) by inheriting the methods and instance data from the base class.
Subclassing is one of the significant features of [http://en.wikipedia.org/wiki/Object-oriented_programming OO programming], which greatly increases the reusability of classes and also minimizes duplication of code. A subclass usually inherits some properties from a super class. [http://en.wikipedia.org/wiki/Inheritance Inheritance] is a design principle in object oriented languages like Java. The reason behind  inheritance is to reuse the code of existing objects or establish a subtype from an object. This greatly improves the efficiency and makes the code more readable as methods which are written only once can be used by a lot of subclasses. A superclass consists of common features that can be extended over subclasses. Superclass and subclass are commonly called base and derived class. The relationship between a subclass and superclass can be represented by a simple UML diagram as shown below.
 
<br>[[File:UML_Subclass.jpg]]
 
Consider the following example given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#Inheritance here].
 
Advantages of subclassing:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w46_sm#Reusability Reusability]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w46_sm#Polymorphism Polymorphism]
 
Disadvantages of subclassing:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w46_sm#Tight_Coupling Tight coupling]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w46_sm#Using_subclassing_solely_for_code_reuse Using subclassing solely for code reuse]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w46_sm#Multiple_Inheritance_Problem Multiple Inheritance Problem]
 
 
In some cases object [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2010/ch3_S30_SK#Decomposition composition] is an alternative to class inheritance to achieve code re-usability. Here, new complex functionality is achieved by assembling or composing objects <ref name="objectcomposition">[http://en.wikipedia.org/wiki/Object_composition Object Composition]</ref>. Unlike inheritance, composition relies on reuse of interface rather than implementation. Consider the new object as a large container <ref name="Design Principles">[http://www.artima.com/lejava/articles/designprinciples4.html Design Principles]</ref>. Complex functionality is achieved in this larger container by placing smaller closed containers inside it. Every smaller object has its own independent implementation hidden from the outer container. Thus composition provides encapsulation in the true sense. This is why composition is also called the black box approach for code reuse. An example is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#Composition here].
 
Another concept related to object composition is that of Aggregation. Suppose we also use a class Person in the Chair class to represent the person occupying the chair <ref name="compositionaggregation">[http://www.adobe.com/devnet/actionscript/learning/oop-concepts/composition-and-aggregation.html Composition and Aggregation]</ref>. Then this person is not initialized in the Chair class as a person has an existence irrespective of the chair, whereas the seat, backrest and legs do not have any existence without the chair.
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2010/ch6_6a_PC Delegation] is a way of making composition as powerful for reuse as inheritance <ref name="Delegation">[http://www.whigg.cas.cn/resource/program/CPP/201010/P020101022562155422801.pdf Design Patterns]</ref>. Delegation involved two objects: a delegator who delegates a operation to another object, the delegatee. This can be compared to inheritance where a subclass "defers" request to the parent class for a method which is not overridden in the subclass <ref name="Delegation">[http://www.whigg.cas.cn/resource/program/CPP/201010/P020101022562155422801.pdf Design Patterns]</ref>. The advantage of delegation over inheritance is that delegation allows composition behavior to occur dynamically at run-time, whereas inheritance causes the relationship to be established statically at compile-time. Although, overuse or delegation may make the code hard to understand and may invite runtime inefficiencies.


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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w8_aa#Examples_of_Mixing here].
Few drawbacks/disadvantages of inheritance are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#Let_us_convince_ourselves_that_Inheritance_is_bad_at_certain_places 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.
After knowing the concepts above, few questions arise:


We shall discuss the concept of Multiple inheritance, advantages & disadvantages of using multiple inheritance and how it is achieved in different Object Oriented languages.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#When_to_use_Inheritance_instead_of_Composition.2FAggregation When to use Inheritance instead of Composition/Aggregation?]


A brief introduction to multiple inheritance is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Introduction here].[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Usage_guide_lines Here] are the usage guidelines of multiple inheritance.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#When_to_use_Composition.2FAggregation_instead_of_Inheritance When to use Aggregation instead of Inheritance?]


A real world example of multiple inheritance is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#A_Real_World_Example here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#When_to_use_Delegation_instead_of_Inheritance When to use Delegation instead of Inheritance?]


==Multiple Inheritance in C++==


[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Introduction''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.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Usage_guide_lines Here] are the usage guidelines of multiple inheritance.A real world example of multiple inheritance is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#A_Real_World_Example here].
C++ supports multiple inheritance. A detailed explantion is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_Inheritance_in_C.2B.2B here].
C++ supports multiple inheritance. A detailed explantion is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_Inheritance_in_C.2B.2B 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_Inheritance_in_Java here].
Ruby doesn't support multiple inheritance but provides a similar feature using [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Modules modules] and  [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Mixins mixins].
Advantages of Mixins are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Advantages_of_mixins 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_inheritance_in_other_languages here].
Advantages and disadvantages of Multiple inheritance are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Advantages here].
Because of few drawbacks(which are discussed above), few languages have implemented concepts like [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Modules Modules] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Mixin_inheritance 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Comparison_between_C.2B.2B.2FJava.2FPython.2FRuby here].


==Multiple Inheritance in JAVA==
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.


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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_Inheritance_in_Java here].
The Object-Oriented programming paradigm has two ways for specifying objects,[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Specifying_Objects Set based language - object specification and Protocol based language - object specification].
Re- implantation of methods in PHP 5 is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w34_vd#Re-_implantation_of_methods_in_PHP_5 here].
 
Re- implantation of methods in Objective-C is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w34_vd#Objective-C here].
Re-implementation of Methods in Python is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w34_vd#Re-implementation_of_Methods_in_Python here].
Re- implantation of methods in Perl is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w34_vd#Re-_implantation_of_methods_in_Perl here].
 
The ‘extend’ feature in computer programming languages allows the programmer to dynamically extend the functionality of an object at run-time, as opposed to extending functionality at compile time. This feature can be found in most Object Oriented Programming (OOP) Languages, some of which are Java, JavaScript, and Ruby. Some OOP languages do not support the 'extend' feature, such as C++.
Languages Using 'extend' Functionality are [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w17_ir#Java JAVA],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w17_ir#JavaScript JavaScript],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w17_ir#Ruby Ruby].
Advantages and disadvantages of 'extend' functionality are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w17_ir#Advantages_.26_Disadvantages here].
 
==Access Control in Object Oriented Languages==
 
<p>In object oriented programming <ref name="Object oriented programming"> [http://en.wikipedia.org/wiki/Object-oriented_programming Object Oriented Programming]</ref>, access control refers to the control of visibility of data and methods. The main idea behind access control is to restrict access to certain parts of the code to external entities. Access control implements and handles O-O features like encapsulation <ref name = "Encapsulation"> [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation]</ref> and inheritance <ref name = "Inheritance"> [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] </ref> by providing varying levels of access to code. The use of access control becomes necessary in any practical environment where selective access is a key criterion. For example, only the instructor can be allowed to modify grades of students but all students should be given access to retrieve and view their respective grades.</p> 
<p>Access control in different object oriented languages and the underlying details will be covered in this topic.</p>
 
Each O-O language has a specific implementation of access control mechanisms. However, a plethora of the most widely used O-O languages share similar features while implementing access control. Access control mechanisms are applicable to class members like variables and functions. Some level of access control can be applied at the class level. The three basic types of access control implementation which is common to some static and dynamic O-O languages <ref name = "Static and Dynamic Languages"> [http://en.wikipedia.org/wiki/Type_system#Static_and_dynamic_typing Static and Dynamic Languages] </ref> [like C++, C#, Java and Ruby] are:
 
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Overview_of_Access_Control_Mechanisms Public]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Overview_of_Access_Control_Mechanisms Private]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Overview_of_Access_Control_Mechanisms Protected]
 
Programming languages implement access control in different ways. The most prominent two ways are encapsulation and inheritance. Few of the languages that use access control and their implementation is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Access_Control_in_O-O_Features here].
 
A comparison table of access control mechanisms among different O-O languages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Comparison_among_different_O-O_languages here].
 
As a good programming practice, these [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Basic_guidelines_on_the_usage_of_Access_Control guidelines] can be used to implement access control mechanisms.
 
The two most commonly used design patterns to handle access control are:
 
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Private_class_data_design_pattern Private class data design pattern].
 
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Decorator_design_pattern Decorator design pattern].
 
Advantages and disadvantages of Access Control are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w15_rt#Advantages_and_disadvantages_of_Access_Control here].
 
==Generic Programming in Object Oriented Languages and Systems==
 
Generic Programming is a programming paradigm for developing efficient and reusable software libraries. The Generic Programming process focuses on finding commonality among similar implementations of the same algorithm, then providing suitable abstractions so that a single, generic algorithm can cover many concrete implementations. This process is repeated until the generic algorithm has reached a suitable level of abstraction, where it provides maximal re-usability while still yielding efficient, concrete implementations.
 
In the simplest definition, generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by Ada in 1983, permits writing common functions or types that differ only in the set of types on which they operate on, thus reducing duplication. Such software entities are known as generics in Ada, Eiffel, Java and .NET; parametric polymorphism in ML, Scala and Haskell ; templates in C++; and parameterized types in the influential 1994 book, Design Patterns.
 
The term generic programming was originally coined by David Musser and Alexander Stepanov in a more specific sense than the above, to describe an approach to software decomposition whereby fundamental requirements on types are abstracted from across concrete examples of algorithms and data structures and formalized as concepts, analogously to the abstraction of algebraic theories in abstract algebra. Early examples of this programming approach were implemented in Scheme and Ada, although the best known example is the Standard Template Library (STL) in which is developed a theory of iterators which is used to decouple sequence data structures and the algorithms operating on them.
 
Generics in .NET framework is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w47_sk#Generics_.NET_framework here].
 
Generics in JAVA is given  [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w47_sk#Generics_in_Java here].
 
Generics in C++ is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w47_sk#Generics_in_C.2B.2B here].
 
==Ruby==
Ruby is a dynamic, reflective, object oriented programming language which was first developed in mid 90s by Yukihiro "Matz" Matsumoto in Japan.[http://en.wikipedia.org/wiki/Ruby_(programming_language)]. It is a cross plat-form interpreted and object-oriented language. In Ruby, everything is an object and every operation is a method call on some object. 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."[http://rubylearning.com/satishtalim/ruby_installation.html]
In 2004, web application framework of Ruby "Ruby on Rails" was introduced by David Heinemeier Hansson.'''Rails''' is a MVC (Model-View-Controller) based architecture for web development based on the Ruby language. Rails 2[http://guides.rubyonrails.org/2_3_release_notes.html] was released in December 2007. Initially Rails 2 supported Ruby 1.8[http://www.ruby-lang.org/en/news/2008/05/31/ruby-1-8-7-has-been-released/]. It now has been updated to support Ruby 1.9.1[http://www.ruby-lang.org/en/news/2009/01/30/ruby-1-9-1-released/].  Rails 3 which brings in many improvements over Rails 2 supports Ruby 1.9 and above. The current stable version of Rails is 3.2.8[http://rubyonrails.org/download] released on Aug 9, 2012.
 
Differences between Rails 2 vs Rails 3 is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w19_sa#Differences_between_Rails_2_and_Rails_3 here]. 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#What_is_an_IDE IDEs] for Ruby are [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#RadRails RadRails],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#Netbeans Netbeans],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#Textmate Textmate],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#RubyMine Rubymine],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#jRuby jRuby] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w29_sa#RDT_.28Ruby_Plugin_for_Eclipse.29 RDT].
A brief outline is given on [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Object objects],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Class classes] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Inheritance inheritance].Ruby can act as a [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Ruby_as_a_set-based_language set-based language] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Ruby_as_a_prototype-based_language prototype-based language].
 
Objects in Ruby are explained [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w55_ms#Objects_In_Ruby here].
 
A Method is a [http://en.wikipedia.org/wiki/Subroutine 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 [http://en.wikipedia.org/wiki/Static_binding Static binding] or [http://en.wikipedia.org/wiki/Dynamic_binding_(computer_science) Dynamic binding]. An example of  a method in Ruby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Methods here].[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Instance_methods Instance methods],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Static_methods static methods],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Accessor_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 [http://en.wikipedia.org/wiki/First-class_function 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 [http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html lexical environment] at the time it was defined.
Examples of closures are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Examples here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Instance_Variables Instance variables] in ruby are defined.Advantages of closures are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Advantages_of_Closures here]. Closures in dynamically typed languages are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w32_cm#CLOSURES_IN_DYNAMICALLY_TYPED_LANGUAGES here]. Closures in statically typed languages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w32_cm#CLOSURES_IN_STATICALLY_TYPED_LANGUAGES here].
The use of closures in other languages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w4_aj#Closures_in_other_languages here]. [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w32_cm#Challenges_due_to_lack_of_closures_in_Statically_typed_languages here] challenges due to lack of closures in Statically typed languages.
 
Class variables and class methods in Ruby are defined [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w56_ms#Class_Variables_and_Class_Methods here].The basic syntax to declare them as class variables and instance variables is also given.
Ruby [http://en.wikipedia.org/wiki/Mixin 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 [http://en.wikipedia.org/wiki/Object-oriented_programming classes], [http://en.wikipedia.org/wiki/Object-oriented_programming 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Uses_of_modules here].
The most interesting fact about the use of modules is to define [http://en.wikipedia.org/wiki/Mixin mixins]. When a module is included within a class,all its functionality becomes available to the class.Modules can contain [http://en.wikipedia.org/wiki/Method_(computer_programming)#Class_methods class methods] and [http://www.daniweb.com/software-development/java/threads/303430/what-is-instance-method instance methods]. Mixins are different from #include and multiple inheritance and this is demonstrated [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#How_mixinsis_different_from_.23include_and_multiple_inheritance.3F here]. More about Mixins can be found [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w16_br#Mixins 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 [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 .
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.
 
The yield function in Ruby passes control to a user-defined code block. More about yield function is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w60_ac#The_yield.28.29_Function here].
 
Namespace in [http://en.wikipedia.org/wiki/C%2B%2B C++] is similar to modulesIn general, a [http://en.wikipedia.org/wiki/Namespace namespace] is a container for a set of identifiers (names), and allows the disambiguation of homonym identifiers residing in different namespaces.[http://en.wikipedia.org/wiki/Namespace Namespace] usually group names based on their functionality. Usage of namespaces and its example is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Steps_involved 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 [http://en.wikipedia.org/wiki/Multiple_inheritance multiple inheritance]. An example is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Example_4 here].
Interfaces in JAVA is similar to mixins.A [http://en.wikipedia.org/wiki/Java_(programming_language) Java] interface defines a set of methods but does not implement them.A class that implements the [http://en.wikipedia.org/wiki/Interface_(Java) interface] agrees to implement all of the methods defined in the interface, thereby agreeing to certain behavior, thereby implementing [http://en.wikipedia.org/wiki/Multiple_inheritance multiple inheritance].
Properties of an interface are:
*An [http://www.codeproject.com/Articles/10553/Using-Interfaces-in-C 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Example_5 here].Comparison between mixins and interfaces and given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w16_br#Mixins_vs._Interfaces here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Comparable Comparable] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Enumerable Enumerable] are commonly used mixins.
 
Ruby has simplified the way programmers use loops and iterators. Ruby helps programmers to use  Don't Repeat Yourself [http://en.wikipedia.org/wiki/Don%27t_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 [http://ruby.bastardsbook.com/chapters/collections/ <b>Collection</b>] 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.<br>
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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_times_iterator times iterator],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_upto_iterator upto iterator],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_step_iterator step iterator],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_each_iterator each iterator],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_collect_iterator collect iterator],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#The_map_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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#Defining_your_own_iterator here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Blocks.5B5.5D 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#Blocks here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Procs.5B6.5D Procs] are nameless block of code that can be represented as an object and can be passed around or called at will.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w31_sa#Lambdas Lambdas] are a more strict form of proc.
 
[http://en.wikipedia.org/wiki/Multiple_inheritance Multiple Inheritance] has several disadvantages that can lead to ambiguous code behavior either during compile time or run time.Ruby does not support direct[http://en.wikipedia.org/wiki/Multiple_inheritance Multiple Inheritance]. But, Multiple Inheritance can be achieved in Ruby through Modules. Modules simulate multiple inheritance in Ruby.Given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Example_8 here] is the Taggable-string example taken from the [http://courses.ncsu.edu/csc517//common/lectures/notes/lec6.pdf 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Resolution_of_Name_conflicts_or_Collisions ways].
Advantages  and disadvantages of multiple inheritance are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Example_8 here].
 
 
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#Expression_Orientation 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.
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w58_am#Functional_Idioms Functional idioms] refers to the various constructs in ruby that mimics [[http://en.wikipedia.org/wiki/Functional_programming 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.
 
[http://en.wikipedia.org/wiki/Regular_expression Regular expressions] are extremely powerful.[http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby]was built as a better [http://en.wikipedia.org/wiki/Perl Perl] hence it supports regular expressions.[http://en.wikipedia.org/wiki/Regular_expression 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w37_ss#Regular_Expressions here].
 
 
[http://en.wikipedia.org/wiki/JRuby JRuby] is the Ruby Programming Language on the [http://en.wikipedia.org/wiki/JVM JVM].
Ruby is a reflective, dynamic, and interpreted object-oriented scripting language. JRuby is a Java programming language implementation of the Ruby language syntax with all the core libraries plus the  standard libraries. With JRuby, you get all of the advantages of Ruby plus access to the full range of Java platform functionality. This can be achieved using the following two flavors.<br>
 
* Driving Ruby from Java
* Driving Java from Ruby
 
Some examples where this integration can be done are:
 
* From a JRuby script, you can call the Java platform Math library to access its powerful computational capabilities or call the Java platform Swing library to display a dialog box that requires end-user input before allowing the script to proceed. <br>
* You can use the [http://en.wikipedia.org/wiki/Scripting_for_the_Java_Platform JSR 223] Scripting APIs or the [http://en.wikipedia.org/wiki/Bean_Scripting_Framework Bean Scripting Framework (BSF)] APIs to call a JRuby script from within a Java application to, for example, invoke back-end processing scripts from a servlet to update or generate web content.  <br>
More about JRuby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w6_pp#JRuby_Explained here].
Advantages of JRuby over JAVA and Ruby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w6_pp#Advantages_of_JRuby here].
Few difficulties of JRuby are addressed [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w6_pp#Difficulties_with_JRuby here].
 
Setting up testing environment for Rails is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w39_sn#Setup_test_environment_in_Rails here].
 
Testing approaches must have a logico-mathematical form, i.e., have one right answer. There are different approaches to software testing and are classified into different levels, depending on the stage of Software Development Life cycle (SDLC) in which it is done. The different levels are [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w18_as#Unit_testing unit testing],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w18_as#Integration_testing integration testing],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w18_as#System_Testing  system testing],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w18_as#Software_performance_testing system integration testing and performance testing].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w39_sn#Fixtures Fixtures] are used for testing in Rails.
 
Ruby provides a framework in its standard library for setting up, organizing, and running tests called Test::Unit <ref>[http://en.wikibooks.org/wiki/Ruby_Programming/Unit_testing Ruby Unit Testing Framework]</ref>. Other testing frameworks available for Ruby are Shoulda, RSpec and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w3_pl#Cucumber Cucumber].
Comparison of Unit Test Frameworks:RSpec,Shoulda and Cucumber is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w3_pl#Comparison_of_Unit_Test_Frameworks_:_Rspec.2C_Shoulda_and_Cucumber here].
More on testing in Ruby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w18_as#Testing_in_Ruby 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w67_ks#Flash_in_Ruby Flash] which persist until the end of the next request received and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w67_ks#Session_in_Ruby Session] hash, which unlike flash persists forever. The working,example,advantages and disadvantages of flash/session is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w67_ks#How_it_works here].
 
Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails deals away with these complexities by providing view helpers for generating form markup.[1] Rails provides excellent features to create forms and gather user input. Forms in Rails are an effective way to obtain user input in a convenient manner. Forms can include different types of data fields that will help obtain different types of data. For example, Text box can fetch a few words from the user and Text Area, a paragraph. Forms are embedded in a Web Application and are very user-friendly. Forms in Rails also have in-built functionalities to verify the data the user enters, validate it using a set of predefined rules, display corresponding error messages(in case of non-compliance) and storing the information in the database if it passes validation.
 
Detailed description about creating forms is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#Creating_a_Form here].
The [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#Actions action] attribute in Rails Forms specifies what to do when a Form is submitted.
 
In rails,routes are used to automatically direct a HTTP request to the appropriate controller action.
With the help of routes one can easily name and configure a URL path i.e the routing engine can figure out where to go and which action to invoke for a given URL. This also works in reverse, which in turn reduces the rigidness in your application structure.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#Views Views] are used to render forms or data to the user. It displays only necessary information and hides internal workings from the user. In views it is more about presentation of data than the data itself. More focus is given to layout and template so as to make it easily readable for the end user.
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#Helpers Helpers] can be used to define any piece of code which will be called many times by the view. Helper methods mainly are used to provide functionality in the views. Also default helper programs can used for otherwise cumbersome to implement functions like date etc
 
General steps to create forms and things to do with forms is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#Things_to_do_with_forms here].
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w66_as#What_does_a_form_look_like.3F Here] is a sample form.
 
==Object-Oriented Domain-Specific Languages (OODSL)==
 
<p>An OODSL<ref>OODSL 1[http://pg-server.csc.ncsu.edu/mediawiki/index.php?title=User:Snateka&printable=yes]</ref><ref>OODSL 2[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2010/ch2_S23_GP]</ref> is a [http://en.wikipedia.org/wiki/Domain-specific_language<code>Domain-specific language</code>] (DSL) that exhibits characteristics that have traditionally been attributed to [http://en.wikipedia.org/wiki/Object-oriented_programming#OOP_languages<code>Object-Oriented Languages</code>] </p>
<p>Although OO languages and Domain specific languages have been around for several years, OODSLs are relatively new.</p>
 
OO languages can be either general purpose like C++, Java and Ruby, or domain specific, like Jquery and Kiddo. The following example shows how the two kinds of languages would work if used in the real world.
 
 
'''The General Purpose Programming way of ordering hash browns at Waffle House'''<ref>Building DSLs [http://www.code-magazine.com/article.aspx?quickid=0902041&page=1]</ref>
 
Harvest the potato, wash it, and chop it into little pieces. Put the pieces in a pan with oil and fry till they turn golden brown, and then drain the oil away and put them on a plate. Now cut some jalapeno peppers and spread on the potatoes. Then add cheese, which you can get by milking a cow and.....
 
'''The OODSL way of ordering hash browns at Waffle House'''
 
I would like it Scattered, Smothered, and Peppered please. Thanks!
 
For a person who works at Waffle House, or goes there regularly to eat, it is a no brainer that the second method is much more efficient. OODSLs take advantage of the context within which communication takes place. By using implicitly understood jargon, the task at hand can be accomplished in a way that is easier to comprehend for a specialized type of user.
 
 
OODSLs can be of 2 types:
 
* Internal--Internal OODSLs are languages that are built on top of existing languages. An internal OODSL makes use of the host language syntax to provide the feel of a domain specific language. It is not universally defined as to when a language/library becomes an OODSL. JQuery is one such example. It is a JavaScript library, which offers an easy way to perform functions like element selection. It can also be argued that JavaScript itself is a domain specific language.
 
* External--External OODSLs are those that are built from scratch. With the current technology, it is far more easy to churn out several internal OODSLs than to build one from scratch. External OODSLs have their own syntax, as well as their own methods of compilation/interpretation.
 
A brief history on OODSL is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#History here]. Languages which incorporate OODSL are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#Examples here].
A running example for creating an OODSL in Groovy is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#A_Running_Example here].
 
When creating an OODSL, one can either choose to start from scratch or use a tool that is already available. Creating a language from scratch gives the programmer a certain amount of flexibility to define it the way he wants to, but it takes a lot of time. Therefore, in general, software tools are used to aid in the process of creating Domain Specific Languages. This is because it not only saves time, but also helps to make the language easy to use due to familiarity with the syntax of the underlying language. Few tools which are used to create OODSL are [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#Boo Boo],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#Visual_Studio Visual Studio] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#Groovy Groovy].
 
Differences between OODSL and non-OODSL is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w9_av#OODSL_vs._non-OODSL here].
 
==Aspect Oriented Programming (AOP)==
 
Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it.
The need of AOP with an example(The banking example) is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#Why_do_we_need_AOP.3F_The_banking_example here].
The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:
 
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AOP_Concepts Joinpoint]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AOP_Concepts Pointcut]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AOP_Concepts Advice]
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AspectJ:_AOP_in_Java AspectJ] is AOP in JAVA.
AOP in Ruby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AOP_in_Ruby here].
We saw how AOP can be implemented in Ruby without any extra support in the above sections.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#AOP_in_Ruby  AspectR] is free library which provides API's to the same for Ruby.
Differences between AspectR and AspectJ is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w27_ms#How_AspectR_is_different_from_AspectJ here].
 
==Object-Relational Mapping==
 
Object-Relational Mapping (ORM) is a methodology for managing data between object oriented systems and relational databases. The premise of the concept is to provide a universal method to access data in a database. This is beneficial for all programming languages that can use objects to store and retrieve data from the database. There are many languages that are using ORM as a technique to manage database data. In the rest of the article, we will discuss ORM and some of the languages in use today.
 
Language extensions for ORM have often been traditionally classified as design patterns or software tools used to perform basic [http://en.wikipedia.org/wiki/Create,_read,_update_and_delete create, read, update and delete (C.R.U.D.)] operations on relational databases, that is, until recent new approaches such as [http://en.wikipedia.org/wiki/ActiveRecord#Ruby ActiveRecord] have grown in popularity.  ActiveRecord is not just a design pattern it is an increase of function to the active record pattern approach by adding [http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 inheritance] and [http://en.wikipedia.org/wiki/Association_%28object-oriented_programming%29 associations].  Examining ActiveRecord and other language extensions will allow for comparisons of the ease of programming using these language extensions verses the conventional database oriented systems approach.
 
All too often programmers are faced with the challenge of persisting objects from their program into a datastore.  Custom code is created for this purpose that can be complex or difficult for others to understand as well as not seem natural.  Applications that are designed to persist data have the need to know how the objects correspond to the information stored in these database tables.  [http://en.wikipedia.org/wiki/Ruby_on_Rails Ruby on Rails], first released in 2005, is able to provide a uniform method to help resolve these complicated issues without sacrificing function or knowledge of these objects by using ActiveRecord (AR).  AR is a persistence engine that comes as part of Ruby on Rails.  "''It creates a 'persistable' domain model from business objects and database tables, where logic and data are presented as a unified package''" [http://en.wikipedia.org/wiki/ActiveRecord#Ruby 3].  AR is admired for its simplistic and elegant approach of removing these levels of complexity.  It allows for a 'pluggable' solution to many different popular databases available today to include: [http://en.wikipedia.org/wiki/MySQL MySQL], [http://en.wikipedia.org/wiki/SQLite SQLite], [http://en.wikipedia.org/wiki/Microsoft_SQL_Server SQL Server], [http://en.wikipedia.org/wiki/PostgreSQL PostgreSQL], and [http://en.wikipedia.org/wiki/Oracle_Database Oracle]. 
 
ActiveRecord uses a [http://en.wikipedia.org/wiki/Single_Table_Inheritance Single Table Inheritance] to allow for inheritance capabilities and provides a set of macros for association relationships between classes of objects, such as belongs_to, has_one, has_many, etc.  AR is not only a component of the [http://en.wikipedia.org/wiki/Model-view-controller Model view-controller (MVC)] for Ruby on Rails but it is also a standalone ORM package for Ruby itself.  Ruby, Ruby on Rails, and ActiveRecord continue to grow in popularity due to not only the curiosity of programmers but their ability to improve function and feature sets while maintaining the initial intent of the language, "''trying to make Ruby natural, not simple''" -- Yukihiro “matz” Matsumoto [http://www.ruby-lang.org/en/about/ 8].  Other languages have been able to learn from AR and have tried to add this capability for themselves.  Let’s take a closer look at some other implementations that attempts to duplicate AR’s elegance.
 
Other examples of Language Extensions are [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#ADO.NET_Entity_Framework ADO.NET Entity Framework],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#Django Django],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#Enterprise_Objects_Framework Enterprise Objects Framework],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#Java.27s_Hibernate Hibernate],[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#JazzRecord_for_JavaScript JazzRecord].
 
Programming using Language Extensions is given briefly [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w10_pk#Programming_using_Language_Extensions here].
 
==Metaprogramming==
 
Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In some cases, this allows programmers to minimize the number of lines of code to express a solution (hence reducing development time), or it gives programs greater flexibility to efficiently handle new situations without recompilation. Typically, you use a metaprogram to eliminate or reduce a tedious or error-prone programming task. So, for example, instead of writing a machine code program by hand, you would use a high-level language, such as C, and then let the C compiler do the translation to the equivalent low-level machine instructions.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w53_kc#Metaprogramming_Example Here] is a metaprogramming example.
 
[http://www.sitepoint.com/typing-versus-dynamic-typing/ Statically typed languages] are those which define and enforce types at compile-time. Statically typed languages typically have clearly distinct compile-time and run-time phases, with program code converted by a compiler into a binary executable which is then run separately. Dynamically typed languages have distinct compilation and execution phases and therefore we  use the terms compile-time and run-time identically for both statically and dynamically typed languages. In most dynamically typed languages (e.g. Ruby, Perl, and Python) ‘running’ a file both compiles and executes it.
 
Metaprogramming in dynamically typed languages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w53_kc#Metaprogramming_in_Dynamically_Typed_Languages here].
 
Metaprogramming in Ruby is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w57_mp#Metaprogramming_in_Ruby here].
 
Advantages and disadvantages of metaprogramming are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w53_kc#Advantages_.26_Disadvantages here].
 
==Databases and Migration==
 
A Database<ref>http://en.wikipedia.org/wiki/Database</ref> is a coherent collection of data with inherent meaning. Random assortment of data is not a database. Data is organized in order to model relevant aspects of reality, so that it supports processes requiring this data.
Data Migration is related to transfer of data between storage types, formats, or computer systems. This is performed programmatically to accomplish an automated migration so that humans are free from doing this repetitive task.
 
A Database is nothing more than a collection of meaningful information.  Databases can be of multiple types, for example Distributed Databases, Relational Databases, Flat File Databases.  A database could be as simple as a text file with a list of names or it can even be very complex as a large relational database management system.<br />
Examples:
<ol>
<li>Banking Systems where accounts are maintained and it is made sure that money does not disappear as a result of system failure.</li>
<li>Airline Reservation Systems where the plane details, the airport details and the customer details are maintained.</li>
<li>Hotel Management Systems where the availability of rooms, the rates and the customer details are maintained.</li>
</ol>
 
A brief description about migrations in database is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Database_Migration here].
 
Creation and updating migrations is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Creating_A_Migration here]. Creating a Standalone Migration is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Creating_a_Standalone_Migration here]. 
 
Anatomy of migrations is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Anatomy_of_Migrations here].
 
Relationship between Model and Migration is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Relationship_between_Model_and_Migration here].
 
Applying Migration to Development and Production is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Applying_Migration_to_Development here].
 
How to run a specific migration is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Running_Specific_Migrations here].
 
Rolling Back a Migration is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Rolling_Back_a_Migration here].
 
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Problems_with_Migration Here] are the few problems with migration.
 
Advantages and disadvantages of Migration are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w62_rb#Advantages_of_Migration here].
 
==Design Patterns==
 
''"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice"'' - [http://www.patternlanguage.com/leveltwo/ca.htm Christopher Alexander]
 
''"In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design".''
 
A [http://en.wikipedia.org/wiki/Design_Patterns Design Pattern] is a template to solve a problem which can be used in many different situations. It names, abstracts and identifies the key aspects of a common design structure that makes it useful for creating a reusable object - oriented design. Design Patterns in [http://en.wikipedia.org/wiki/Object-oriented_programming Object - Oriented Languages] help show the relationship between the different classes and objects in the program. Design Patterns are tools for building software.
 
 
A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design
 
The different types of design patterns can be categorized and listed as below:
 
[http://en.wikipedia.org/wiki/Creational_pattern Creational Pattern], which help create the objects for the user, instead of having the user to instantiate the object.
* [http://www.oodesign.com/factory-pattern.html'''''Factory Pattern'''''], which allows a class to defer instantiation to subclasses.
* [http://www.oodesign.com/abstract-factory-pattern.html'''''Abstract Factory Pattern'''''], which provides an interface for creating related or dependent objects without specifying the objects' concrete classes.
* [http://www.oodesign.com/builder-pattern.html'''''Builder Pattern'''''], which separates the construction of a complex object from its representation so that the same construction process can create different representation.
* [http://www.oodesign.com/prototype-pattern.html'''''Prototype Pattern'''''], which specifies the kind of object to create using a prototypical instance, and creates new objects by cloning this prototype.
* [http://www.oodesign.com/singleton-pattern.html'''''Singleton Pattern'''''], which ensures that only one instance of a class is created and provides a global access point to the object.
[http://en.wikipedia.org/wiki/Structural_pattern Structural Pattern], which employ interfaces to achieve inheritance to enable objects to obtain new functionality.
* [http://www.oodesign.com/adapter-pattern.html'''''Adapter Pattern'''''], which 'adapts' one interface for a class into one that a client expects.
* [http://www.oodesign.com/bridge-pattern.html'''''Bridge Pattern'''''], which decouples an abstraction from its implementation so that the two can vary independently.
* [http://www.oodesign.com/composite-pattern.html'''''Composite Pattern'''''], which represents a tree structure of objects where every object has the same interface.
* [http://www.oodesign.com/decorator-pattern.html'''''Decorator Pattern'''''], which adds additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes
* [http://sourcemaking.com/design_patterns/facade'''''Facade Pattern'''''], which creates a simplified interface of an existing interface to ease usage for common tasks.
* [http://www.oodesign.com/flyweight-pattern.html'''''Flyweight Pattern'''''], where a high quantity of objects share a common properties object to save space.
* [http://www.oodesign.com/proxy-pattern.html'''''Proxy Pattern'''''], where a class functions as an interface to another thing.
[http://en.wikipedia.org/wiki/Behavioral_pattern Behavioral Pattern], which are concerned with communication between objects.
* [http://www.oodesign.com/command-pattern.html'''''Command Pattern'''''], which enables to pass around the code that needs to be executed later. More about Command Pattern is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w52_an here].
* [http://www.oodesign.com/chain-of-responsibility-pattern.html'''''Chain of Responsibility Pattern'''''], where command objects are handled or passed on to other objects by logic-containing processing objects.
* [http://www.oodesign.com/interpreter-pattern.html'''''Interpreter Pattern'''''], which implements a specialized computer language to rapidly solve a specific set of problems.
* [http://www.oodesign.com/iterator-pattern.html'''''Iterator Pattern'''''], where iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation.
* [http://www.oodesign.com/mediator-pattern.html'''''Mediator Pattern'''''], which provides a unified interface to a set of interfaces in a subsystem.
* [http://www.oodesign.com/memento-pattern.html'''''Memento Pattern'''''], which provides the ability to restore an object to its previous state (rollback).
* [http://www.oodesign.com/observer-pattern.html'''''Observer Pattern'''''], is similar to Publish/Subscribe or Event Listener. Objects register to observe an event that may be raised by another object.
* [http://sourcemaking.com/design_patterns/state'''''State Pattern'''''], is a clean way for an object to partially change its type at runtime.
* [http://www.oodesign.com/strategy-pattern.html'''''Strategy Pattern'''''], where Algorithms can be selected on the fly.
* [http://www.oodesign.com/template-method-pattern.html'''''Template Pattern'''''], which describes the program skeleton of a program.
* [http://www.oodesign.com/visitor-pattern.html'''''Visitor Pattern'''''], is a way to separate an algorithm from an object.
 
The ''Active Record pattern'' is a [http://en.wikipedia.org/wiki/Software_design_pattern Design pattern] in Software Engineering which deals with the approach to store and access data in a database.A brief introduction on Active Record  Pattern is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Introduction here].
 
Naming conventions for Active Record Pattern is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Naming here].
 
CRUD stands for '[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Create Create]', '[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Read Read]' , '[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Update Update]' and '[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Delete Delete]'. These are the four basic operations which are generally performed on tables in a database. The ActiveRecord module provides predefined methods for the basic CRUD operations for the model.
 
Details about how you connect to the databaseis given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Connecting_to_the_Database here].
 
Migrations help to version the various changes made to databases. It also allow developers to track a set of changes made to production or development databases and to rollback to a previous version if needed. Building a migration is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#Building_a_Migration here].
 
Associations are used to connect two models. The association is used to describe the role of relations that models are having with each other. ActiveRecord associations can be used to describe one-to-one (1:1), one-to-many (1:n) and many-to-many (n:m) relationships between models. Associations are used to make common operations simpler and easier in your code. Rails supports six types of associations:
 
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#belongs_to_Association belongs_to]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#has_one_Association has_one]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#has_many_Association has_many]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#has_many_:through_Association has_many :through]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#has_one_:through_Association has_one :through]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w63_dv#has_and_belongs_to_many_Association has_and_belongs_to_many]
 
belongs_to and has_one form a one-to-one relationship. has_one :through is a different way to create a one-to-one relationship. has_many and belongs_to form a one-to-many relation. has_and_belongs_to_many or an alternative way has_many :through to create a many-to-many relationship
Little about design patterns in Ruby is explained [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w42_js#Creational_Patterns here].
 
A Comparison table for singleton,adapter,command and strategy pattern is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w42_js#Comparison_of_the_different_Design_Patterns here].
 
==Currying==
 
Currying is a term which is associated with Mathematics and computer science. Currying is the mathematical process of using a function with multiple arguments such that a string of multiple functions with single argument can be called to realize the same function. In other words, currying is defined as delayed function of incomplete arguments which works normally when arguments are supplied.
Back in 1924 Moses Ilyich Schönfinkel, a Russian logician, discovered this property of function. But this discovery of his was later re discovered and built upon by Haskell Curry , an American mathematician and logician. In honor of the contributions made by Haskell Curry the technique was named after him.
Definition of currying is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w35_sa#What_is_currying.3F here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w35_sa#Applications_of_currying Here] are few applications of currying.
Differences between Partial functions and Currying are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w35_sa#Difference_between_Partial_functions_and_Currying here].
The main advantage of currying is that it provides a way to proof read the functions and check whether all have been applied uniformly on all the arguments. There are other advantages as well like decreasing the amount of complicated codes and hence high level of maintainability. This when compared to partials becomes more accurate for same reason. But as the cliche goes, every coin has two sides, there are few disadvantages of currying as well. The major disadvantage of currying is that it has performance issues. The code is though simple but might result in lengthy ones when compared to partials and hence calling the curried functions might fetch slow performance rate.
Uncurrying is de-functaionlization of curried functions. It takes additional parameters along with curried function to return the actual function with all the arguments. Multiple iterations might be required to get back the original (uncurried) function.
 
==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 '''[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#History 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#MVC_pattern_in_web_application_development here].
 
MVC Architecture is explained briefly [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w38_nm#Model_View_Controller_.28MVC.29_Architecture 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.
[http://struts.apache.org/ Struts] for Java, [http://en.wikipedia.org/wiki/Maypole_framework Maypole] for Perl and [http://rubyonrails.org/ Rails] for Ruby are some to name a few. A brief introduction of the MVC pattern in Ruby on Rails and Struts is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#Web_frameworks_using_MVC_pattern here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#Spring_framework Spring framework] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#Java_Server_Faces.28JSF.29 Java Server Faces] are two examples of MVC pattern.
Advantages and disadvantages of MVC pattern is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w20_pp#Conclusion here].
 
Cookbook Application is a very basic Ruby on Rails application. It is a great way to understand the nuances that ‘Ruby’ has to offer. It is built keeping in mind that the reader is new to the world of ruby and is developing his/her first Ruby on Rails application. A sample Cookbook application is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w38_nm#Cookbook_Application here].
 
==Behavior-Driven Design==
 
 
Behaviour Driven Design( abbreviated '''BDD''') is a [http://en.wikipedia.org/wiki/Software_development_methodology software development methodology] which involves incorporating [http://en.wikipedia.org/wiki/Stakeholder stakeholder’s] point of view in the development of the software. The software is implemented by taking into consideration its behavior as described by its stakeholders.
 
BDD was developed by [http://dannorth.net/introducing-bdd Dan North ] .BDD comes under [http://en.wikipedia.org/wiki/Agile_software_development agile development]. Agile development came into picture to overcome the reasons for software project failure.Some of the reasons for software project failure are:<ref name="video">http://www.youtube.com/watch?v=q_A5kAMygOI<br></ref>
 
* Lack of understanding of user requirements.
* Changing requirements
* Pressure to meet the project deadline.
* Budget and time constraints
* Difficulty in software development and management
* Miscommunication or lack of communication between stakeholders.
 
Agile development involves stakeholder participation throughout the lifetime of the product.
BDD helps achieve this objective of agile development.[http://en.wikipedia.org/wiki/User_story User stories] are written in BDD to describe the feature that is to be implemented.User stories can then be used to write tests to check  the behaviour desired by the stakeholder.[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development] approach can then be used to implement the system.
 
BDD is explained in detail [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w69_mv#Understanding_BDD here].
 
[http://jbehave.org/ JBehave] and [http://dannorth.net/2007/06/17/introducing-rbehave/ RBehave] are the two popular [http://en.wikipedia.org/wiki/Software_framework frameworks] that support BDD.  


==Multiple Inheritance in RUBY==
The steps for the BDD approach is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w69_mv#Frameworks_for_BDD here].


Ruby doesn't support multiple inheritance but provides a similar feature using [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Modules modules] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Mixins mixins].
Advantages and disadvantages of BDD and User Stories are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w69_mv#Advantages_of_BDD_and_User_Stories here].


Advantages of Mixins are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Advantages_of_mixins here].
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as "stories". This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL


==Multiple inheritance in Scala and Python==
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass.


A brief explanation of Multiple inheritance in Scala and Python is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w23_as#Multiple_inheritance_in_other_languages here].
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides [http://www.debian.org/doc/manuals/intro-i18n/ i18n] language support for feature and step files.  


==Advantages and disadvantages of Multiple inheritance==


Advantages and disadvantages of Multiple inheritance are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Advantages here].
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for [http://en.wikipedia.org/wiki/Ruby_on_Rails Rails] applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.


==Alternatives of Multiple Inheritance==
A brief history about Cucumber is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#History_and_the_need_for_development here].


Because of few drawbacks(which are discussed above), few languages have implemented concepts like [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Modules Modules] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Mixin_inheritance Mixins] to emulate the power of multiple inheritance.
Setting up Cucumber is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Setting_up_Cucumber here].


==Comparison between C++/Java/Python/Ruby==
Cucumber testing comprises of two components namely:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Features Features]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Step_Definitions Step Definitions]


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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w14_gv#Comparison_between_C.2B.2B.2FJava.2FPython.2FRuby here].
Setting up Capybara is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Setting_up_Capybara here].


='''Code Reuse'''=
An example of running Cucumber tests on Capybara is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Example_of_running_Cucumber_tests_on_Capybara here].


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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Definition here].
The advantages of Cucumber are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w71_gs#Advantages here].


==Techniques in Code Reuse==
==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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Definition here].
There are several [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Techniques_.5B4.5D techniques] in code reuse. Code can be reused by using simple coding.
There are several [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Techniques_.5B4.5D techniques] in code reuse. Code can be reused by using simple coding.
For example, using a [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Single_lines_of_code single line of code], we can reuse the code.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Procedures.2C_Macros Procedures and macros] are the low level code reuse techniques.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Functions.2Fmethods Methods] can be used in code reuse, a method can be defined and declared multiple times wherever required.
For example, using a [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Single_lines_of_code single line of code], we can reuse the code.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Procedures.2C_Macros Procedures and macros] are the low level code reuse techniques.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Functions.2Fmethods Methods] can be used in code reuse, a method can be defined and declared multiple times wherever required.
An individual [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Components software component] is a software package, a Web service, or a module that encapsulates a set of related functions.
An individual [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Components 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.
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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Object_orientation_.5B5.5D Packages,modules and inheritance], we can achieve code reuse.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Generators.5B6.5D Generators,Software architectures, code scavenging, Transformational systems, Very High Level Languages (VHLL)] are more techniques of code reuse.
Here are some of the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Best_practices_.5B7.5D 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Advantages_.5B3.5D here].
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Trade-offs_for_code_reuse_at_various_levels_of_components_.5B8.5D Here] are few of the tradeoffs for code reuse at various levels of components.
==Collection Framework==
A Collection is a data structure representing a group of data items sharing common properties (or state) and behaviour. Generally data items represents object of same type and their behaviour is governed by the set of operation that can be performed on them. An Array also represents a group of related objects but Array are not considered as collection because an array can only hold a fixed number of items however size of collection is variable, or dynamic. In sum, a collection can be viewed as a single object containing multiple numbers of elements. Few collection types include trees, sets, ArrayList, Dictionary etc.
In order to create, manage and manipulate collection, we have collection framework which depicts representation and manipulation of collection elements independent of their implementation details. It defines application programming interfaces (API’s) consisting of classes and interfaces for manipulating data in collection.
[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w30_rp#Advantages_of_collection_framework Here] are few advantages of collection framework.
Elements of collection framework:
a) [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w30_rp#Collection_Interfaces_and_Implementations Collection Interfaces]
b) [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w30_rp#Collection_Interfaces_and_Implementations Implementations]
c) [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w30_rp#Algorithm_in_Collection_Framework Algorithm]


With the help of [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Object_orientation_.5B5.5D Packages,modules and inheritance], we can achieve code reuse.
Implementation of Collection framework in .NET is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w30_rp#Implementation_of_Collection_in_.NET here].
 
==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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w12_mv#Origin_and_Evolution here].
Scaffolding in MVC based web frameworks is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1a_1w12_mv#Scaffolding_in_MVC_based_Web_Frameworks 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.
 
==Refactoring==
 
Refactoring is a technique for restructuring existing code. It is defined as altering the code's internal structure without changing its external behavior. It is done as a series of small transformations which together produce significant restructuring. Since each transformation is small, it's less likely to go wrong. The system is also kept fully working after each small transformation, reducing the chances that a system can get seriously broken during the restructuring.When people make small changes to the code without fully understanding its design, the code loses its structure, which eventually has a cumulative effect. If the developer cannot understand the code design, then it becomes more difficult for him to preserve it. Timely refactoring helps the code to retain its shape.
Automated refactoring refers to refactoring which is under the developers control. What we mean by this is that, the system is not responsible for deciding what refactoring is required, rather this is the job of the developer. Automated refactoring is a feature of most widely used IDE's today, which helps expedite the task of refactoring for the developers.
In this article, we are aiming at describing the various techniques for automated refactoring. This article gives a clear understanding of these techniques which are illustrated with examples. We have also given a comparison of the refactoring functionality provided by various frequently used IDE's.
 
Common Refactoring Techniques are:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Extraction_Refactoring Extraction Refactoring]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Inline_Refactoring Inline Refactoring]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Encapsulating_Fields Encapsulating Fields]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Changing_Method_Signature Changing Method Signature]
 
Few other refactoring techniques are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Other_Refactorings here].
 
A table regarding Refactoring support in popular IDE(s)is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w45_is#Refactoring_support_in_popular_IDE.28s.29 here].
 
==Reflection==
 
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming 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 [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], methods, attributes, etc. at runtime. More advanced uses of reflection let you list and call methods, [http://en.wikipedia.org/wiki/Constructor_%28object-oriented_programming%29 constructors], etc. A little more introduction about reflection is found [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_as#Introduction 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 [http://en.wikipedia.org/wiki/Type_introspection 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 [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) 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.
 
A brief history of Reflection is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w5_su#Brief_History_of_Reflection here].
There are two basic types of reflection. They are:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_ar#Behavioral_Reflection Behavioral Reflection]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_ar#Structural_Reflection Structural Reflection]
 
There are two techniques used by reflective systems:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w5_su#Introspection Introspection]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w5_su#Intercession Intercession]
 
A brief comparison between Reflective Languages Features and Reflective Packages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w5_su#Reflective_Languages_Features_VS_Reflective_Packages].
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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_as#Applications_of_Reflection here].
Comparison of reflection in different languages is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_ar#Comparison_of_Reflection_in_different_languages here].
Advantages and disadvantages of reflection are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1b_1w40_as#Advantages_and_Disadvantages_of_reflection here].
 
==CRC Cards==
<b> CRC Cards, </b> also known as [http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card <b> Class-Responsibility-Collaboration <sup></sup></b>] 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 <b>Ward Cunningham</b> and <b>Kent Beck</b><sup>[http://c2.com/doc/oopsla89/paper.html]</sup>. The CRC card can be viewed as an index card, with the following details:
[[Image:crc-card.gif|frame|right|CRC Card Structure]]
 
:* 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 [http://en.wikipedia.org/wiki/Use_case Use case]. <br> <br> According to <sup>[http://www.extremeprogramming.org/rules/crccards.html]</sup><i>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.</i>
 
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 <b>Student CRC Card</b> 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 <b>Course</b> class. The <b>Course CRC Card</b> 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 <b>Instructor
class</b>. The CRC cards for the Student class and the Course Class are shown below.<br><br>
[[Image:Stud_enr_Crc.jpg|frame|center|Student and Course CRC Card]]
<br>
There are also several practical designs that use the CRC card model to design Object oriented software design. The  [http://www.extremeprogramming.org/example/crcsim.html Simulator for Coffee Maker] explores an [http://en.wikipedia.org/wiki/Extreme_Programming 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 [http://www.math-cs.gordon.edu/courses/cps211/ATMExample/CRCCards.html ATM Machine]


[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Generators.5B6.5D Generators,Software architectures, code scavenging, Transformational systems, Very High Level Languages (VHLL)] are more techniques of code reuse.
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
<br>
:* 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 [http://en.wikipedia.org/wiki/Extreme_Programming Extreme Programming] (an [http://en.wikipedia.org/wiki/Agile_Modeling Agile] development Technique) and can be used along with modeling languages such as [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language(UML)]
An example of CRC cards is given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#A_CRC_Example 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
<br>
:* 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 [http://en.wikipedia.org/wiki/Extreme_Programming Extreme Programming] (an [http://en.wikipedia.org/wiki/Agile_Modeling Agile] development Technique) and can be used along with modeling languages such as [http://en.wikipedia.org/wiki/Unified_Modeling_Language 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#Software_for_CRC_Cards these] reasons.[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#Designing_Software 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#The_Waterfall_Model Waterfall model] and [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#The_Spiral_Model 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w11_ap#CRC_Cards_in_Software_Development_Process here].


Here are some of the [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Best_practices_.5B7.5D best practices] to be followed to make sure that the code that is being written is reusable.
==Version Control System==
A [http://en.wikipedia.org/wiki/Revision_control 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 [http://en.wikipedia.org/wiki/Software_configuration_management 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 [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w1_rk#Why_version_control_systems_are_needed.3F here].
VCS' can be broadly categorized into three groups based on the repository model:
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w1_rk#Local_repository_model_.5B1.5D Local repository model]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w1_rk#Client-server_model Client-server model]
*[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w1_rk#Distributed_model Distributed model]


==Advantages and Disadvantages of Code Reuse==
Criteria for selecting a particular version control system:
*Size of project
*Number of developers working on the project
*Distribution of developers working on the project.
*Technology used for developing
*Plug-ins for IDE’s
*Learning curve
*Speed
*Functionality
*User interfaces (Web and GUI)


Advantages and disadvantages of code reuse can be found [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Advantages_.5B3.5D here].
Examples of version control systems:
*[http://www.nongnu.org/cvs/ CVS]
*[http://www.bitkeeper.com/ Bitkeeper]
*[http://subversion.apache.org/ Subversion (SVN)]
*[http://www.monotone.ca/ Monotone]
*[http://www.perforce.com/ Perforce]
*[http://git-scm.com/ Git]
*[http://bazaar.canonical.com/en/ Bazaar]
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]
*[http://mercurial.selenic.com/ Mercurial]


[http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w7_am#Trade-offs_for_code_reuse_at_various_levels_of_components_.5B8.5D Here] are few of the tradeoffs for code reuse at various levels of components.
==UML Representation==


The Unified Modeling Language standard specifies graphical notations for object oriented models. Representations of inheritance,composition and aggregation are given [http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2012/ch1_1w24_nr#UML_Representation here].


=References=
=References=


http://en.wikipedia.org/wiki/Component-based_software_engineering
http://en.wikipedia.org/wiki/Component-based_software_engineering
http://en.wikipedia.org/wiki/Functional_programming
http://en.wikipedia.org/wiki/Functional_programming
http://docs.python.org/dev/howto/functional.html
http://docs.python.org/dev/howto/functional.html
http://searchsoa.techtarget.com/definition/object-oriented-programming
http://searchsoa.techtarget.com/definition/object-oriented-programming

Latest revision as of 22:47, 29 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 Design (OOD)

Object Oriented Design (OOD) is a methodology to develop a solution by creating structured objects which interact with each other through well defined interfaces. The object interaction involves invocation of required services and exchange of corresponding data. An object contains data and set of methods or procedures which act on that data. Access to data can be controlled based on access specifiers. The input to the problem is passed to the object through method invocations which are defined by the interfaces. Interfaces define the procedure name and the parameters. The object implements the methods of the interfaces and also encapsulate data needed for solving the problem which can include instances of other objects.

Here is an example of Object Oriented Design.

Advantages of Object Oriented Design:

  • Code Reusablility
  • Real-World Modeling
  • Robustness and Reliability
  • Less Maintenance

Traits of a poor Object Oriented Design are given here.

Little about Software success and Software failure is given here.

The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:

There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:

There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:

“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan & Plauger At the heart of great design are a set of principles and patterns.Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems.

Essential use cases are abstrat, lightweight, technology-free dialogues of user intension and system responsibility, that effectively capture requirements for design of a system. Working with essential use cases yeilds further benefits: analysts can take advantage of recurring patterns in essential use cases and the crucial common vocabulary of responsibilities lets designers trace directly from the essential use cases to the objects in their design.

There are some tips that can be used in designing to enhance and improve the object-oriented projects:

Factors leading to Poor OOD are:

One of the major causes of limited success in adopting object-oriented methodologies is the failure of management and design teams to recognize and plan for the scope of this change. If preventive measure are taken software failure can be avoided and organizations can benefit from OOD. Assessing quality of software at the design level will provide ease and higher accuracy for users.Some of the methods are listed below:

Here are some well known software failures.

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.


In any programming language, the data type refers to the class of data which contains specific type or range of values. Data types are used along with variables used in the program. The data type tells us what kind of values the variable can store, what is the range of the values and how much space the values take in memory etc.

The primitive data types refer to the built-in data types which are supported by the programming language. Often 'data types' and 'primitive data types' are used interchangeably. But not all data types are primitive. Programming languages have some non-primitive data types or derived data types which are provided by the language by making use of its primitive data types.

The common built-in data types or primitive data types are integers, floating point numbers, characters, strings and boolean.

  • Integers - Integers represent the whole numbers which can be positive or negative or zero, e.g. 9999, 0, -25, etc.
  • Floating point numbers - Floating point numbers represent the numbers which are fractions or contain floating-decimal points, e.g. -3.002, 2.5, 22.0, etc.
  • Characters - Characters represent any single letter, number, space, punctuation mark, or symbol that can be typed on a computer, e.g. 'a', '9', ' ', '!' , '\n', etc.
  • Strings - Strings represent the sequences of characters or simply any text, e.g. "Hello!", "9 am to 6 pm", etc.
  • Booleans - Booleans represent the true or false values. Sometimes, instead of true and false, 1 and 0 are used to represent the boolean values.

Many object-oriented programming languages provide support for primitive data types while some object-oriented programming languages provide support for primitive objects along with primitive types.

Primitive objects refer to the objects of built-in classes which provide more functionality than the primitive types. Some object-oriented programming languages provide support for only primitive objects (i.e., in such languages all primitive types are objects).

Different object-oriented programming languages implement these primitive data types and primitive objects in a different manner.

Primitive objects in different OO languages like C++,JAVA,C#,JavaScript,Ruby are explained here.

Advantages of using primitive data types are:

Disadvantages of using primitive data types are:

Subclassing is a principle of creating a specialization(subclass/ [1]) of a base class(superclass/ parent class) by inheriting the methods and instance data from the base class. Subclassing is one of the significant features of OO programming, which greatly increases the reusability of classes and also minimizes duplication of code. A subclass usually inherits some properties from a super class. Inheritance is a design principle in object oriented languages like Java. The reason behind inheritance is to reuse the code of existing objects or establish a subtype from an object. This greatly improves the efficiency and makes the code more readable as methods which are written only once can be used by a lot of subclasses. A superclass consists of common features that can be extended over subclasses. Superclass and subclass are commonly called base and derived class. The relationship between a subclass and superclass can be represented by a simple UML diagram as shown below.


Consider the following example given here.

Advantages of subclassing:

Disadvantages of subclassing:


In some cases object composition is an alternative to class inheritance to achieve code re-usability. Here, new complex functionality is achieved by assembling or composing objects <ref name="objectcomposition">Object Composition</ref>. Unlike inheritance, composition relies on reuse of interface rather than implementation. Consider the new object as a large container <ref name="Design Principles">Design Principles</ref>. Complex functionality is achieved in this larger container by placing smaller closed containers inside it. Every smaller object has its own independent implementation hidden from the outer container. Thus composition provides encapsulation in the true sense. This is why composition is also called the black box approach for code reuse. An example is given here.

Another concept related to object composition is that of Aggregation. Suppose we also use a class Person in the Chair class to represent the person occupying the chair <ref name="compositionaggregation">Composition and Aggregation</ref>. Then this person is not initialized in the Chair class as a person has an existence irrespective of the chair, whereas the seat, backrest and legs do not have any existence without the chair.

Delegation is a way of making composition as powerful for reuse as inheritance <ref name="Delegation">Design Patterns</ref>. Delegation involved two objects: a delegator who delegates a operation to another object, the delegatee. This can be compared to inheritance where a subclass "defers" request to the parent class for a method which is not overridden in the subclass <ref name="Delegation">Design Patterns</ref>. The advantage of delegation over inheritance is that delegation allows composition behavior to occur dynamically at run-time, whereas inheritance causes the relationship to be established statically at compile-time. Although, overuse or delegation may make the code hard to understand and may invite runtime inefficiencies.

Few drawbacks/disadvantages of inheritance are given here.

After knowing the concepts above, few questions arise:

When to use Inheritance instead of Composition/Aggregation?

When to use Aggregation instead of Inheritance?

When to use Delegation instead of Inheritance?


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.

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.

The Object-Oriented programming paradigm has two ways for specifying objects,Set based language - object specification and Protocol based language - object specification. Re- implantation of methods in PHP 5 is given here.

Re- implantation of methods in Objective-C is given here. Re-implementation of Methods in Python is given here. Re- implantation of methods in Perl is given here.

The ‘extend’ feature in computer programming languages allows the programmer to dynamically extend the functionality of an object at run-time, as opposed to extending functionality at compile time. This feature can be found in most Object Oriented Programming (OOP) Languages, some of which are Java, JavaScript, and Ruby. Some OOP languages do not support the 'extend' feature, such as C++. Languages Using 'extend' Functionality are JAVA,JavaScript,Ruby. Advantages and disadvantages of 'extend' functionality are given here.

Access Control in Object Oriented Languages

In object oriented programming <ref name="Object oriented programming"> Object Oriented Programming</ref>, access control refers to the control of visibility of data and methods. The main idea behind access control is to restrict access to certain parts of the code to external entities. Access control implements and handles O-O features like encapsulation <ref name = "Encapsulation"> Encapsulation</ref> and inheritance <ref name = "Inheritance"> Inheritance </ref> by providing varying levels of access to code. The use of access control becomes necessary in any practical environment where selective access is a key criterion. For example, only the instructor can be allowed to modify grades of students but all students should be given access to retrieve and view their respective grades.

Access control in different object oriented languages and the underlying details will be covered in this topic.

Each O-O language has a specific implementation of access control mechanisms. However, a plethora of the most widely used O-O languages share similar features while implementing access control. Access control mechanisms are applicable to class members like variables and functions. Some level of access control can be applied at the class level. The three basic types of access control implementation which is common to some static and dynamic O-O languages <ref name = "Static and Dynamic Languages"> Static and Dynamic Languages </ref> [like C++, C#, Java and Ruby] are:

Programming languages implement access control in different ways. The most prominent two ways are encapsulation and inheritance. Few of the languages that use access control and their implementation is given here.

A comparison table of access control mechanisms among different O-O languages is given here.

As a good programming practice, these guidelines can be used to implement access control mechanisms.

The two most commonly used design patterns to handle access control are:

Advantages and disadvantages of Access Control are given here.

Generic Programming in Object Oriented Languages and Systems

Generic Programming is a programming paradigm for developing efficient and reusable software libraries. The Generic Programming process focuses on finding commonality among similar implementations of the same algorithm, then providing suitable abstractions so that a single, generic algorithm can cover many concrete implementations. This process is repeated until the generic algorithm has reached a suitable level of abstraction, where it provides maximal re-usability while still yielding efficient, concrete implementations.

In the simplest definition, generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by Ada in 1983, permits writing common functions or types that differ only in the set of types on which they operate on, thus reducing duplication. Such software entities are known as generics in Ada, Eiffel, Java and .NET; parametric polymorphism in ML, Scala and Haskell ; templates in C++; and parameterized types in the influential 1994 book, Design Patterns.

The term generic programming was originally coined by David Musser and Alexander Stepanov in a more specific sense than the above, to describe an approach to software decomposition whereby fundamental requirements on types are abstracted from across concrete examples of algorithms and data structures and formalized as concepts, analogously to the abstraction of algebraic theories in abstract algebra. Early examples of this programming approach were implemented in Scheme and Ada, although the best known example is the Standard Template Library (STL) in which is developed a theory of iterators which is used to decouple sequence data structures and the algorithms operating on them.

Generics in .NET framework is given here.

Generics in JAVA is given here.

Generics in C++ is given here.

Ruby

Ruby is a dynamic, reflective, object oriented programming language which was first developed in mid 90s by Yukihiro "Matz" Matsumoto in Japan.[2]. It is a cross plat-form interpreted and object-oriented language. In Ruby, everything is an object and every operation is a method call on some object. 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."[3] In 2004, web application framework of Ruby "Ruby on Rails" was introduced by David Heinemeier Hansson.Rails is a MVC (Model-View-Controller) based architecture for web development based on the Ruby language. Rails 2[4] was released in December 2007. Initially Rails 2 supported Ruby 1.8[5]. It now has been updated to support Ruby 1.9.1[6]. Rails 3 which brings in many improvements over Rails 2 supports Ruby 1.9 and above. The current stable version of Rails is 3.2.8[7] released on Aug 9, 2012.

Differences between Rails 2 vs Rails 3 is given here. 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.

Objects in Ruby are explained here.

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. Closures in dynamically typed languages are given here. Closures in statically typed languages is given here. The use of closures in other languages is given here. here challenges due to lack of closures in Statically typed languages.

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.

The yield function in Ruby passes control to a user-defined code block. More about yield function is given here.

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.


JRuby is the Ruby Programming Language on the JVM. Ruby is a reflective, dynamic, and interpreted object-oriented scripting language. JRuby is a Java programming language implementation of the Ruby language syntax with all the core libraries plus the standard libraries. With JRuby, you get all of the advantages of Ruby plus access to the full range of Java platform functionality. This can be achieved using the following two flavors.

  • Driving Ruby from Java
  • Driving Java from Ruby

Some examples where this integration can be done are:

  • From a JRuby script, you can call the Java platform Math library to access its powerful computational capabilities or call the Java platform Swing library to display a dialog box that requires end-user input before allowing the script to proceed.
  • You can use the JSR 223 Scripting APIs or the Bean Scripting Framework (BSF) APIs to call a JRuby script from within a Java application to, for example, invoke back-end processing scripts from a servlet to update or generate web content.

More about JRuby is given here. Advantages of JRuby over JAVA and Ruby is given here. Few difficulties of JRuby are addressed here.

Setting up testing environment for Rails is given here.

Testing approaches must have a logico-mathematical form, i.e., have one right answer. There are different approaches to software testing and are classified into different levels, depending on the stage of Software Development Life cycle (SDLC) in which it is done. The different levels are unit testing,integration testing,system testing,system integration testing and performance testing. Fixtures are used for testing in Rails.

Ruby provides a framework in its standard library for setting up, organizing, and running tests called Test::Unit <ref>Ruby Unit Testing Framework</ref>. Other testing frameworks available for Ruby are Shoulda, RSpec and Cucumber. Comparison of Unit Test Frameworks:RSpec,Shoulda and Cucumber is given here. More on testing in Ruby is given 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.

Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails deals away with these complexities by providing view helpers for generating form markup.[1] Rails provides excellent features to create forms and gather user input. Forms in Rails are an effective way to obtain user input in a convenient manner. Forms can include different types of data fields that will help obtain different types of data. For example, Text box can fetch a few words from the user and Text Area, a paragraph. Forms are embedded in a Web Application and are very user-friendly. Forms in Rails also have in-built functionalities to verify the data the user enters, validate it using a set of predefined rules, display corresponding error messages(in case of non-compliance) and storing the information in the database if it passes validation.

Detailed description about creating forms is given here. The action attribute in Rails Forms specifies what to do when a Form is submitted.

In rails,routes are used to automatically direct a HTTP request to the appropriate controller action. With the help of routes one can easily name and configure a URL path i.e the routing engine can figure out where to go and which action to invoke for a given URL. This also works in reverse, which in turn reduces the rigidness in your application structure. Views are used to render forms or data to the user. It displays only necessary information and hides internal workings from the user. In views it is more about presentation of data than the data itself. More focus is given to layout and template so as to make it easily readable for the end user.

Helpers can be used to define any piece of code which will be called many times by the view. Helper methods mainly are used to provide functionality in the views. Also default helper programs can used for otherwise cumbersome to implement functions like date etc

General steps to create forms and things to do with forms is given here.

Here is a sample form.

Object-Oriented Domain-Specific Languages (OODSL)

An OODSL<ref>OODSL 1[8]</ref><ref>OODSL 2[9]</ref> is a Domain-specific language (DSL) that exhibits characteristics that have traditionally been attributed to Object-Oriented Languages

Although OO languages and Domain specific languages have been around for several years, OODSLs are relatively new.

OO languages can be either general purpose like C++, Java and Ruby, or domain specific, like Jquery and Kiddo. The following example shows how the two kinds of languages would work if used in the real world.


The General Purpose Programming way of ordering hash browns at Waffle House<ref>Building DSLs [10]</ref>

Harvest the potato, wash it, and chop it into little pieces. Put the pieces in a pan with oil and fry till they turn golden brown, and then drain the oil away and put them on a plate. Now cut some jalapeno peppers and spread on the potatoes. Then add cheese, which you can get by milking a cow and.....

The OODSL way of ordering hash browns at Waffle House

I would like it Scattered, Smothered, and Peppered please. Thanks!

For a person who works at Waffle House, or goes there regularly to eat, it is a no brainer that the second method is much more efficient. OODSLs take advantage of the context within which communication takes place. By using implicitly understood jargon, the task at hand can be accomplished in a way that is easier to comprehend for a specialized type of user.


OODSLs can be of 2 types:

  • Internal--Internal OODSLs are languages that are built on top of existing languages. An internal OODSL makes use of the host language syntax to provide the feel of a domain specific language. It is not universally defined as to when a language/library becomes an OODSL. JQuery is one such example. It is a JavaScript library, which offers an easy way to perform functions like element selection. It can also be argued that JavaScript itself is a domain specific language.
  • External--External OODSLs are those that are built from scratch. With the current technology, it is far more easy to churn out several internal OODSLs than to build one from scratch. External OODSLs have their own syntax, as well as their own methods of compilation/interpretation.

A brief history on OODSL is given here. Languages which incorporate OODSL are given here. A running example for creating an OODSL in Groovy is given here.

When creating an OODSL, one can either choose to start from scratch or use a tool that is already available. Creating a language from scratch gives the programmer a certain amount of flexibility to define it the way he wants to, but it takes a lot of time. Therefore, in general, software tools are used to aid in the process of creating Domain Specific Languages. This is because it not only saves time, but also helps to make the language easy to use due to familiarity with the syntax of the underlying language. Few tools which are used to create OODSL are Boo,Visual Studio and Groovy.

Differences between OODSL and non-OODSL is given here.

Aspect Oriented Programming (AOP)

Aspect Oriented Programming (AOP) refers to a new way of designing software. It aims to increase modularity by allowing the separation of cross-cutting concerns. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. It is not a replacement to popular Object Oriented Programming (OOP), but is complimentary to it. The need of AOP with an example(The banking example) is given here. The advice-related component of an aspect-oriented language defines a join point model (JPM). A JPM defines three things:

AspectJ is AOP in JAVA. AOP in Ruby is given here. We saw how AOP can be implemented in Ruby without any extra support in the above sections.AspectR is free library which provides API's to the same for Ruby. Differences between AspectR and AspectJ is given here.

Object-Relational Mapping

Object-Relational Mapping (ORM) is a methodology for managing data between object oriented systems and relational databases. The premise of the concept is to provide a universal method to access data in a database. This is beneficial for all programming languages that can use objects to store and retrieve data from the database. There are many languages that are using ORM as a technique to manage database data. In the rest of the article, we will discuss ORM and some of the languages in use today.

Language extensions for ORM have often been traditionally classified as design patterns or software tools used to perform basic create, read, update and delete (C.R.U.D.) operations on relational databases, that is, until recent new approaches such as ActiveRecord have grown in popularity. ActiveRecord is not just a design pattern it is an increase of function to the active record pattern approach by adding inheritance and associations. Examining ActiveRecord and other language extensions will allow for comparisons of the ease of programming using these language extensions verses the conventional database oriented systems approach.

All too often programmers are faced with the challenge of persisting objects from their program into a datastore. Custom code is created for this purpose that can be complex or difficult for others to understand as well as not seem natural. Applications that are designed to persist data have the need to know how the objects correspond to the information stored in these database tables. Ruby on Rails, first released in 2005, is able to provide a uniform method to help resolve these complicated issues without sacrificing function or knowledge of these objects by using ActiveRecord (AR). AR is a persistence engine that comes as part of Ruby on Rails. "It creates a 'persistable' domain model from business objects and database tables, where logic and data are presented as a unified package" 3. AR is admired for its simplistic and elegant approach of removing these levels of complexity. It allows for a 'pluggable' solution to many different popular databases available today to include: MySQL, SQLite, SQL Server, PostgreSQL, and Oracle.

ActiveRecord uses a Single Table Inheritance to allow for inheritance capabilities and provides a set of macros for association relationships between classes of objects, such as belongs_to, has_one, has_many, etc. AR is not only a component of the Model view-controller (MVC) for Ruby on Rails but it is also a standalone ORM package for Ruby itself. Ruby, Ruby on Rails, and ActiveRecord continue to grow in popularity due to not only the curiosity of programmers but their ability to improve function and feature sets while maintaining the initial intent of the language, "trying to make Ruby natural, not simple" -- Yukihiro “matz” Matsumoto 8. Other languages have been able to learn from AR and have tried to add this capability for themselves. Let’s take a closer look at some other implementations that attempts to duplicate AR’s elegance.

Other examples of Language Extensions are ADO.NET Entity Framework,Django,Enterprise Objects Framework,Hibernate,JazzRecord.

Programming using Language Extensions is given briefly here.

Metaprogramming

Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In some cases, this allows programmers to minimize the number of lines of code to express a solution (hence reducing development time), or it gives programs greater flexibility to efficiently handle new situations without recompilation. Typically, you use a metaprogram to eliminate or reduce a tedious or error-prone programming task. So, for example, instead of writing a machine code program by hand, you would use a high-level language, such as C, and then let the C compiler do the translation to the equivalent low-level machine instructions. Here is a metaprogramming example.

Statically typed languages are those which define and enforce types at compile-time. Statically typed languages typically have clearly distinct compile-time and run-time phases, with program code converted by a compiler into a binary executable which is then run separately. Dynamically typed languages have distinct compilation and execution phases and therefore we use the terms compile-time and run-time identically for both statically and dynamically typed languages. In most dynamically typed languages (e.g. Ruby, Perl, and Python) ‘running’ a file both compiles and executes it.

Metaprogramming in dynamically typed languages is given here.

Metaprogramming in Ruby is given here.

Advantages and disadvantages of metaprogramming are given here.

Databases and Migration

A Database<ref>http://en.wikipedia.org/wiki/Database</ref> is a coherent collection of data with inherent meaning. Random assortment of data is not a database. Data is organized in order to model relevant aspects of reality, so that it supports processes requiring this data. Data Migration is related to transfer of data between storage types, formats, or computer systems. This is performed programmatically to accomplish an automated migration so that humans are free from doing this repetitive task.

A Database is nothing more than a collection of meaningful information. Databases can be of multiple types, for example Distributed Databases, Relational Databases, Flat File Databases. A database could be as simple as a text file with a list of names or it can even be very complex as a large relational database management system.
Examples:

  1. Banking Systems where accounts are maintained and it is made sure that money does not disappear as a result of system failure.
  2. Airline Reservation Systems where the plane details, the airport details and the customer details are maintained.
  3. Hotel Management Systems where the availability of rooms, the rates and the customer details are maintained.

A brief description about migrations in database is given here.

Creation and updating migrations is given here. Creating a Standalone Migration is given here.

Anatomy of migrations is given here.

Relationship between Model and Migration is given here.

Applying Migration to Development and Production is given here.

How to run a specific migration is given here.

Rolling Back a Migration is given here.

Here are the few problems with migration.

Advantages and disadvantages of Migration are given here.

Design Patterns

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice" - Christopher Alexander

"In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design".

A Design Pattern is a template to solve a problem which can be used in many different situations. It names, abstracts and identifies the key aspects of a common design structure that makes it useful for creating a reusable object - oriented design. Design Patterns in Object - Oriented Languages help show the relationship between the different classes and objects in the program. Design Patterns are tools for building software.


A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design

The different types of design patterns can be categorized and listed as below:

Creational Pattern, which help create the objects for the user, instead of having the user to instantiate the object.

  • Factory Pattern, which allows a class to defer instantiation to subclasses.
  • Abstract Factory Pattern, which provides an interface for creating related or dependent objects without specifying the objects' concrete classes.
  • Builder Pattern, which separates the construction of a complex object from its representation so that the same construction process can create different representation.
  • Prototype Pattern, which specifies the kind of object to create using a prototypical instance, and creates new objects by cloning this prototype.
  • Singleton Pattern, which ensures that only one instance of a class is created and provides a global access point to the object.

Structural Pattern, which employ interfaces to achieve inheritance to enable objects to obtain new functionality.

  • Adapter Pattern, which 'adapts' one interface for a class into one that a client expects.
  • Bridge Pattern, which decouples an abstraction from its implementation so that the two can vary independently.
  • Composite Pattern, which represents a tree structure of objects where every object has the same interface.
  • Decorator Pattern, which adds additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes
  • Facade Pattern, which creates a simplified interface of an existing interface to ease usage for common tasks.
  • Flyweight Pattern, where a high quantity of objects share a common properties object to save space.
  • Proxy Pattern, where a class functions as an interface to another thing.

Behavioral Pattern, which are concerned with communication between objects.

  • Command Pattern, which enables to pass around the code that needs to be executed later. More about Command Pattern is given here.
  • Chain of Responsibility Pattern, where command objects are handled or passed on to other objects by logic-containing processing objects.
  • Interpreter Pattern, which implements a specialized computer language to rapidly solve a specific set of problems.
  • Iterator Pattern, where iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation.
  • Mediator Pattern, which provides a unified interface to a set of interfaces in a subsystem.
  • Memento Pattern, which provides the ability to restore an object to its previous state (rollback).
  • Observer Pattern, is similar to Publish/Subscribe or Event Listener. Objects register to observe an event that may be raised by another object.
  • State Pattern, is a clean way for an object to partially change its type at runtime.
  • Strategy Pattern, where Algorithms can be selected on the fly.
  • Template Pattern, which describes the program skeleton of a program.
  • Visitor Pattern, is a way to separate an algorithm from an object.

The Active Record pattern is a Design pattern in Software Engineering which deals with the approach to store and access data in a database.A brief introduction on Active Record Pattern is given here.

Naming conventions for Active Record Pattern is given here.

CRUD stands for 'Create', 'Read' , 'Update' and 'Delete'. These are the four basic operations which are generally performed on tables in a database. The ActiveRecord module provides predefined methods for the basic CRUD operations for the model.

Details about how you connect to the databaseis given here.

Migrations help to version the various changes made to databases. It also allow developers to track a set of changes made to production or development databases and to rollback to a previous version if needed. Building a migration is given here.

Associations are used to connect two models. The association is used to describe the role of relations that models are having with each other. ActiveRecord associations can be used to describe one-to-one (1:1), one-to-many (1:n) and many-to-many (n:m) relationships between models. Associations are used to make common operations simpler and easier in your code. Rails supports six types of associations:

belongs_to and has_one form a one-to-one relationship. has_one :through is a different way to create a one-to-one relationship. has_many and belongs_to form a one-to-many relation. has_and_belongs_to_many or an alternative way has_many :through to create a many-to-many relationship Little about design patterns in Ruby is explained here.

A Comparison table for singleton,adapter,command and strategy pattern is given here.

Currying

Currying is a term which is associated with Mathematics and computer science. Currying is the mathematical process of using a function with multiple arguments such that a string of multiple functions with single argument can be called to realize the same function. In other words, currying is defined as delayed function of incomplete arguments which works normally when arguments are supplied. Back in 1924 Moses Ilyich Schönfinkel, a Russian logician, discovered this property of function. But this discovery of his was later re discovered and built upon by Haskell Curry , an American mathematician and logician. In honor of the contributions made by Haskell Curry the technique was named after him. Definition of currying is given here. Here are few applications of currying. Differences between Partial functions and Currying are given here. The main advantage of currying is that it provides a way to proof read the functions and check whether all have been applied uniformly on all the arguments. There are other advantages as well like decreasing the amount of complicated codes and hence high level of maintainability. This when compared to partials becomes more accurate for same reason. But as the cliche goes, every coin has two sides, there are few disadvantages of currying as well. The major disadvantage of currying is that it has performance issues. The code is though simple but might result in lengthy ones when compared to partials and hence calling the curried functions might fetch slow performance rate. Uncurrying is de-functaionlization of curried functions. It takes additional parameters along with curried function to return the actual function with all the arguments. Multiple iterations might be required to get back the original (uncurried) function.

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.

MVC Architecture is explained briefly 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.

Cookbook Application is a very basic Ruby on Rails application. It is a great way to understand the nuances that ‘Ruby’ has to offer. It is built keeping in mind that the reader is new to the world of ruby and is developing his/her first Ruby on Rails application. A sample Cookbook application is given here.

Behavior-Driven Design

Behaviour Driven Design( abbreviated BDD) is a software development methodology which involves incorporating stakeholder’s point of view in the development of the software. The software is implemented by taking into consideration its behavior as described by its stakeholders.

BDD was developed by Dan North .BDD comes under agile development. Agile development came into picture to overcome the reasons for software project failure.Some of the reasons for software project failure are:<ref name="video">http://www.youtube.com/watch?v=q_A5kAMygOI
</ref>

  • Lack of understanding of user requirements.
  • Changing requirements
  • Pressure to meet the project deadline.
  • Budget and time constraints
  • Difficulty in software development and management
  • Miscommunication or lack of communication between stakeholders.

Agile development involves stakeholder participation throughout the lifetime of the product. BDD helps achieve this objective of agile development.User stories are written in BDD to describe the feature that is to be implemented.User stories can then be used to write tests to check the behaviour desired by the stakeholder.Test Driven Development approach can then be used to implement the system.

BDD is explained in detail here.

JBehave and RBehave are the two popular frameworks that support BDD.

The steps for the BDD approach is given here.

Advantages and disadvantages of BDD and User Stories are given here.

Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as "stories". This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL

Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass.

Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files.


Capybara is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.

A brief history about Cucumber is given here.

Setting up Cucumber is given here.

Cucumber testing comprises of two components namely:

Setting up Capybara is given here.

An example of running Cucumber tests on Capybara is given here.

The advantages of Cucumber are 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.

Collection Framework

A Collection is a data structure representing a group of data items sharing common properties (or state) and behaviour. Generally data items represents object of same type and their behaviour is governed by the set of operation that can be performed on them. An Array also represents a group of related objects but Array are not considered as collection because an array can only hold a fixed number of items however size of collection is variable, or dynamic. In sum, a collection can be viewed as a single object containing multiple numbers of elements. Few collection types include trees, sets, ArrayList, Dictionary etc.

In order to create, manage and manipulate collection, we have collection framework which depicts representation and manipulation of collection elements independent of their implementation details. It defines application programming interfaces (API’s) consisting of classes and interfaces for manipulating data in collection.

Here are few advantages of collection framework.

Elements of collection framework: a) Collection Interfaces b) Implementations c) Algorithm

Implementation of Collection framework in .NET is given here.

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.

Refactoring

Refactoring is a technique for restructuring existing code. It is defined as altering the code's internal structure without changing its external behavior. It is done as a series of small transformations which together produce significant restructuring. Since each transformation is small, it's less likely to go wrong. The system is also kept fully working after each small transformation, reducing the chances that a system can get seriously broken during the restructuring.When people make small changes to the code without fully understanding its design, the code loses its structure, which eventually has a cumulative effect. If the developer cannot understand the code design, then it becomes more difficult for him to preserve it. Timely refactoring helps the code to retain its shape. Automated refactoring refers to refactoring which is under the developers control. What we mean by this is that, the system is not responsible for deciding what refactoring is required, rather this is the job of the developer. Automated refactoring is a feature of most widely used IDE's today, which helps expedite the task of refactoring for the developers. In this article, we are aiming at describing the various techniques for automated refactoring. This article gives a clear understanding of these techniques which are illustrated with examples. We have also given a comparison of the refactoring functionality provided by various frequently used IDE's.

Common Refactoring Techniques are:

Few other refactoring techniques are given here.

A table regarding Refactoring support in popular IDE(s)is given here.

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 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.

A brief history of Reflection is given here. There are two basic types of reflection. They are:

There are two techniques used by reflective systems:

A brief comparison between Reflective Languages Features and Reflective Packages is given [11]. 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[12]. The CRC card can be viewed as an index card, with the following details:

CRC Card Structure
  • 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 [13]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.

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.

Student and Course CRC Card


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

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:

Criteria for selecting a particular version control system:

  • Size of project
  • Number of developers working on the project
  • Distribution of developers working on the project.
  • Technology used for developing
  • Plug-ins for IDE’s
  • Learning curve
  • Speed
  • Functionality
  • User interfaces (Web and GUI)

Examples of version control systems:

UML Representation

The Unified Modeling Language standard specifies graphical notations for object oriented models. Representations of inheritance,composition and aggregation are given here.

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