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

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 53: Line 53:
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].  
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].  


='''Multiple 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.
We shall discuss the concept of Multiple inheritance, advantages & disadvantages of using multiple inheritance and how it is achieved in different Object Oriented languages.
==Introduction==
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.
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].
==Multiple Inheritance in C++==
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].
==Multiple Inheritance in JAVA==
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].
==Multiple Inheritance in RUBY==
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].
==Multiple inheritance in Scala and Python==
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==
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].
==Alternatives of Multiple Inheritance==
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.
==Comparison between C++/Java/Python/Ruby==
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].





Revision as of 09:59, 7 November 2012

Introduction

This wiki page will give you the outline of the topics from Wiki 1a and 1b. A brief introduction to the topics covered(in 1a and 1b) and the links to the appropriate topic is available on this page.

Object Oriented Programming in Ruby

Ruby is a dynamic, reflective, general-purpose object-oriented programming language.Ruby is all about objects.

Object Oriented Programming

The link given above contains an introduction to Object Oriented Programming and its primary concepts like abstraction,polymorphism,encapsulation and inheritance are explained. It mainly explains Object Oriented Programming in Ruby. A brief outline is given on objects,classes and inheritance.

Instance Variables,Instance Methods and Accessor Methods

Instance variables in ruby are defined.Instance methods and Accessor methods are explained briefly along with examples.

Class Variables and Class Methods

Class variables and Class Methods in Ruby are defined. The basic syntax to declare them as class variables and instance variables is given.

Functional Programming and Object Oriented Programming

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

Object Oriented Programming

Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic.

Features and advantages of Object oriented programming is given here.

Mixing Functional and Object-Oriented Programming

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.

Functional Techniques useful for Object-Oriented Programming

Some of the basic features of Functional Programming which can be combined with Object Oriented paradigm are:

Examples of mixing

A number of programming languages support mixing of both functional and object-oriented code. Three of these (Scala, Ruby, and Conjure), are described in more detail here.

Multiple Inheritance

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.

We shall discuss the concept of Multiple inheritance, advantages & disadvantages of using multiple inheritance and how it is achieved in different Object Oriented languages.

Introduction

A brief introduction to multiple inheritance is given here.Here are the usage guidelines of multiple inheritance.

A real world example of multiple inheritance is given here.

Multiple Inheritance in C++

C++ supports multiple inheritance. A detailed explantion is given here.

Multiple Inheritance in JAVA

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.

Multiple Inheritance in RUBY

Ruby doesn't support multiple inheritance but provides a similar feature using modules and mixins.

Advantages of Mixins are given here.

Multiple inheritance in Scala and Python

A brief explanation of Multiple inheritance in Scala and Python is given here.

Advantages and disadvantages of Multiple inheritance

Advantages and disadvantages of Multiple inheritance are given here.

Alternatives of Multiple Inheritance

Because of few drawbacks(which are discussed above), few languages have implemented concepts like Modules and Mixins to emulate the power of multiple inheritance.

Comparison between C++/Java/Python/Ruby

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.


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.

Techniques in Code Reuse

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

Advantages and disadvantages of code reuse can be found here.

Here are few of the tradeoffs for code reuse at various levels of components.


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