SlideShare une entreprise Scribd logo
1  sur  3
Télécharger pour lire hors ligne
Insight
                        Insight




On the Notion of
Object-Oriented
Programming
This article discusses the fundamentals of object orientation, and in the process dispels
some myths about it.




98   JANUARY 2008   |    LINUX FOR YOU   |   www.linuxforu.com



                                                                 CMYK
Insight



             bject-oriented               these features and still can be                 the problems that may need



O            progFramming (OOP)
             has been the most
             popular programming
             paradigm for more than
two decades and has been the
subject of active research for quite
                                          considered as a good OO language.

                                          An example of flawed
                                          arguments
                                          I recently heard the following
                                          argument: “Java is better than C++
                                                                                          multiple inheritance can be
                                                                                          rewritten using only single
                                                                                          inheritance (possibly with some
                                                                                          difficulty). Because of such
                                                                                          reasons, a language designer can
                                                                                          make a design decision to support
some time now.                            because Java is a ‘pure’ object-                or not support multiple inheritance
    With such widespread use, we          oriented language. Java allows no               in her language. However, just
would expect the essence or basic         global variables, it has a common               because an OO language supports
tenets of OOP to be widely known          Object base class, and it does not              multiple inheritance we cannot
to students and practitioners.            support multiple inheritance and so             label it as a ‘bad’ language.
However, the essentials are not           on. But C++ is a bad object-oriented                As Paul Weiss wisely
often understood or followed well in      language because it supports                    commented: “It’s one thing not to
practice. By just programming in an       procedural programs, has no                     see the forest for the trees, but
object-oriented language does not         common base class, supports                     then to go on to deny the reality of
necessarily mean that we do that          multiple inheritance, etc.”                     the forest is a more serious
task well. In this article we will look        I like both Java and C++, but              matter.”
at the fundamentals of object             that aside, let us analyse why this
orientation and try to understand         argument is inherently flawed.                  Characteristics and benefits
why it has become so successful.               Just because we believe that Java          OOP is based on the solid
We’ll also dispel some myths and          is a ‘pure’ OO language, it need not            foundation provided by the
face some hard facts about OOP            be better than C++. Why is ‘pure’               concepts of inheritance,
technology.                               object-orientation better than any              polymorphism, abstraction and
                                          other approach (like the multi-                 encapsulation.
The basics                                paradigm approach in C++)? What                     An abstract data type provides
What is object-oriented                   are the criteria for concluding                 us with the ability to think of a
programming? Hanspeter                    whether a language is ‘pure’ or                 type in its abstract interface level
Mossenbock’s Object-Oriented              ‘impure’? Doesn’t Java’s support                and use it depending on its
Programming in Oberon-2                   of C-style conditional and looping              interface only (without concerning
[Springer-Verlag, 1993] provides the      constructs, and primitive types                 ourselves with the implementation
following definition: “Object-            make it ‘impure’? Just because a                details; otherwise, there is nothing
oriented programming means                language also supports other                    ‘abstract’ about an ADT). Since
programming with abstract data            paradigms doesn’t mean that it is a             OOP is based on the solid
types (classes) using inheritance         bad OO language.                                foundation provided by
and dynamic binding.” This makes it            Providing a common base class is           abstraction, it is possible to create
clear that OOP is about using ADTs        a design decision that a language               complex software that hides a lot
with inheritance and virtual              designer makes in an OO language.               of implementation details. Because
functions.                                Based on information and category               of this, object orientation is
    Many of the attributes we             theories, many researchers have                 suitable for programming on a
often associate with OOP aren’t           supported the argument that having              large scale.
inherently associated with this           a common class as a base class for all              Inheritance is the mechanism
definition. Strictly speaking,            the classes is unnatural and a non-             in which common properties of
having a common base class (say,          intuitive design.                               various classes (or objects, in case
the object class), or language                 Inheritance is one of the                  of object inheritance) are
features like namespaces,                 fundamental features of OOP. A                  abstracted and provided in
exception handling, RTTI (RunTime         language without any form of                    common base classes, thereby
Type Identification), reflection,         inheritance support cannot claim to             creating relationships between
operator overloading, function            be an OOP language. Multiple                    related types. Inheritance is
overloading, etc, are nothing to do       inheritance is just one kind of                 important for design since it helps
with OOP, as such. However, many          inheritance and it is common to see             to organise classes in terms of the
modern OOP languages (like Java)          it in use (for example, a two-in-one            natural relationship between the
have a lot of these features, which       set inherits the properties of both a           types. In inheritance many of the
doesn’t mean they are                     tape-recorder and a radio).                     details of the derived classes will
characteristics of object orientation     Practically, it is difficult to use             only be known later in the design
itself. A language can have none of       multiple inheritance correctly, and             stage. Also, because of the


                                                                  www.linuxforu.com   |     LINUX FOR YOU   |   JANUARY 2008     99


                                                       CMYK
Insight



classification of related types, we          background, it takes more time               With OOP we can write
can write code for general types             to learn the object-oriented              generic, reusable components
(instead of code that works or               approach than to learn the                and sell it independently.
assumes specific types). This gives          language features.
rise to runtime polymorphism where               Object-oriented programs are              Partially true! One of the
late binding of actual methods for           typically more difficult to understand    fundamental benefits with OOP is
the code is resolved. With                   than their procedural equivalent.         the ability to write reusable code,
inheritance (and runtime                     For example, to understand how            but OOP hasn’t delivered fully in the
polymorphism), it is easier to               to use a derived class, we need to go     writing and distributing of generic
introduce new changes and extend             through the public members of that        reusable code, in practice. Writing
the software with new types without          class and also the public members         COTS (Components Off The Shelf)
affecting the rest of the code, so           of all of its base classes. The effort    software is still not fully possible
OOP programming                              required to understand and make           with OOP. The emerging areas of
enables writing extensible software.         use of class libraries, frameworks        component software and generic
Object orientation also enables              or inheritance hierarchies is             programming paradigms address
providing abstract or concrete               considerable.                             this shortcoming of OOP.
classes as libraries and related                 Object orientation provides a
classes as frameworks; instead of            higher level of abstraction from             OOP emerged based on solid
(re)writing classes every time,              low-level details and it provides         theoretical foundations.
we can reuse the classes. So                 features to model higher-level
object orientation helps writing             relationships between classes. This          False! Unlike programming
reusable software.                           flexibility also comes with some          paradigms like functional
    So the ability to handle complex         loss of efficiency compared to            programming, which is based on
code (enhanced maintainability),             straightforward procedural                lambda calculus and emerged from
the ability to extend the code               constructs. For example, to               extensive academic research,
based on specific requirements               support runtime polymorphism, an          object orientation came into
later (extensibility) and the ability        extra level of indirection is needed      practical use first and was later
to use or reuse the code                     to invoke a virtual method. In other      subjected to extensive research.
(reusability) are the main benefits          words, a virtual method call is           Theoretical understanding of
promised by OOP.                             almost always slower than a direct        many of the areas on OOP is still
                                             method call. Such additional              hazy and OOP continues to be a
Costs and drawbacks                          overhead for abstracting low-level        subject of active research.
OOP is not a panacea for the                 details is known as an abstraction
problems faced by the software               penalty in OOP.                              It takes time to master
industry today. With more than                                                         object-oriented programming
three decades of experience in               Some myths and realities                  and design.
using object-oriented programs, the          We will encounter many myths
hype and over-enthusiasm in                  associated with OOP. Let us check             True! It is easy to understand
promoting object orientation has             the validity of some of them here.        the basic tenets, features and ideas
subsided and the costs of object-                                                      of OOP. However, it takes
oriented programming are clear.                 Software written in OOP is             considerable time to master the
    Object orientation requires a            better than non-OOP software.             analysis, design and implementation
new way of thinking (different from                                                    techniques to create quality
procedural thinking), and it is                  False! While it is true that OOP      solutions using object-oriented
difficult to comprehend object-              provides significant help in creating     technology. As they say, nothing
oriented programs. Since object              quality software, the quality of the      good ever comes easy!
orientation provides a higher level          software we create is in our hands, and
of abstraction from machine-level            good or bad software has nothing to do
                                                                                       By: S.G. Ganesh is a research
details, there is some loss of               with OOP. We can write high-quality
                                                                                       engineer in Siemens (Corporate
efficiency (compared to procedural           code in other programming paradigms
                                                                                       Technology). His latest book is “60
programs).                                   (like functional programming);
                                                                                       Tips for Object Oriented
    The benefits of OOP aren’t               similarly, we can also write sloppy
                                                                                       Programming”, published by Tata-
automatically available to programs          code following OO approach. So, it is
                                                                                       McGraw Hill in December this year.
written in the procedural way—               incorrect to make claims like: “My
                                                                                       You can reach him at
by just using OOP constructs.                software is better than your’s because
                                                                                       sgganesh@gmail.com
For programmers with a procedural            mine is OO whereas yours isn’t!”


100   JANUARY 2008   |   LINUX FOR YOU   |   www.linuxforu.com



                                                                 CMYK

Contenu connexe

Tendances (10)

Basis for comparison programming languages
Basis for comparison programming languagesBasis for comparison programming languages
Basis for comparison programming languages
 
Oop
OopOop
Oop
 
Start a deep learning startup - tutorial
Start a deep learning startup - tutorialStart a deep learning startup - tutorial
Start a deep learning startup - tutorial
 
BERT
BERTBERT
BERT
 
Object Oriented Programming : A Brief History and its significance
Object Oriented Programming : A Brief History and its significanceObject Oriented Programming : A Brief History and its significance
Object Oriented Programming : A Brief History and its significance
 
Pal gov.tutorial4.session1 2.whatisontology
Pal gov.tutorial4.session1 2.whatisontologyPal gov.tutorial4.session1 2.whatisontology
Pal gov.tutorial4.session1 2.whatisontology
 
Pal gov.tutorial4.session6 2.knowledge double-articulation
Pal gov.tutorial4.session6 2.knowledge double-articulationPal gov.tutorial4.session6 2.knowledge double-articulation
Pal gov.tutorial4.session6 2.knowledge double-articulation
 
Pal gov.tutorial4.session13.arabicontology
Pal gov.tutorial4.session13.arabicontologyPal gov.tutorial4.session13.arabicontology
Pal gov.tutorial4.session13.arabicontology
 
Pal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnetsPal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnets
 
Oops
OopsOops
Oops
 

En vedette

An Introduction To C++Templates
An Introduction To C++TemplatesAn Introduction To C++Templates
An Introduction To C++Templates
Ganesh Samarthyam
 
Writing Efficient Code Feb 08
Writing Efficient Code Feb 08Writing Efficient Code Feb 08
Writing Efficient Code Feb 08
Ganesh Samarthyam
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
Ganesh Samarthyam
 
Refactoring for design smells
Refactoring for design smellsRefactoring for design smells
Refactoring for design smells
Ganesh Samarthyam
 

En vedette (20)

2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals
 
Oop Extract
Oop ExtractOop Extract
Oop Extract
 
Java Multithreading
Java MultithreadingJava Multithreading
Java Multithreading
 
An Introduction To C++Templates
An Introduction To C++TemplatesAn Introduction To C++Templates
An Introduction To C++Templates
 
Writing Efficient Code Feb 08
Writing Efficient Code Feb 08Writing Efficient Code Feb 08
Writing Efficient Code Feb 08
 
Inside.Net
Inside.NetInside.Net
Inside.Net
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
Intermediate Languages
Intermediate LanguagesIntermediate Languages
Intermediate Languages
 
Which programming language should you learn next?
Which programming language should you learn next? Which programming language should you learn next?
Which programming language should you learn next?
 
Ocpjp book
Ocpjp bookOcpjp book
Ocpjp book
 
How to Build a Great Career - 6 Specific Tips
How to Build a Great Career - 6 Specific TipsHow to Build a Great Career - 6 Specific Tips
How to Build a Great Career - 6 Specific Tips
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Applying Design Principles in Practice
Applying Design Principles in PracticeApplying Design Principles in Practice
Applying Design Principles in Practice
 
Java or c++
Java or c++Java or c++
Java or c++
 
Refactoring for design smells
Refactoring for design smellsRefactoring for design smells
Refactoring for design smells
 
Functional programming & immutable data.
Functional programming & immutable data.Functional programming & immutable data.
Functional programming & immutable data.
 
Design patterns through refactoring
Design patterns through refactoringDesign patterns through refactoring
Design patterns through refactoring
 
ITFT- C,c++,java and world wide web
ITFT- C,c++,java and world wide webITFT- C,c++,java and world wide web
ITFT- C,c++,java and world wide web
 
itft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in javaitft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in java
 
Boost Your IT Career with IEEE's Software Engineering Certifications
Boost Your IT Career with IEEE's Software Engineering Certifications Boost Your IT Career with IEEE's Software Engineering Certifications
Boost Your IT Career with IEEE's Software Engineering Certifications
 

Similaire à Oop Article Jan 08

A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
Rikki Wright
 
Evolution Of Object Oriented Technology
Evolution Of Object Oriented TechnologyEvolution Of Object Oriented Technology
Evolution Of Object Oriented Technology
Sharon Roberts
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
Jessica Deakin
 
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docxA Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
daniahendric
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
BalamuruganV28
 
Java Fundamentals Of Computer Science Using Java
Java   Fundamentals Of Computer Science Using JavaJava   Fundamentals Of Computer Science Using Java
Java Fundamentals Of Computer Science Using Java
Prabhu vip
 

Similaire à Oop Article Jan 08 (20)

What is oops concept in java?
What is oops concept in java?What is oops concept in java?
What is oops concept in java?
 
A Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And RlbpA Strong Object Recognition Using Lbp, Ltp And Rlbp
A Strong Object Recognition Using Lbp, Ltp And Rlbp
 
Evolution Of Object Oriented Technology
Evolution Of Object Oriented TechnologyEvolution Of Object Oriented Technology
Evolution Of Object Oriented Technology
 
OOP Java
OOP JavaOOP Java
OOP Java
 
Research paper
Research paperResearch paper
Research paper
 
Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docxA Survey of Object Oriented Programming LanguagesMaya Hris.docx
A Survey of Object Oriented Programming LanguagesMaya Hris.docx
 
object oriented programming(oops)
object oriented programming(oops)object oriented programming(oops)
object oriented programming(oops)
 
Java OOPs Concepts.docx
Java OOPs Concepts.docxJava OOPs Concepts.docx
Java OOPs Concepts.docx
 
Java for C++ programers
Java for C++ programersJava for C++ programers
Java for C++ programers
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 
Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2
 
Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2Class notes(week 2) on basic concepts of oop-2
Class notes(week 2) on basic concepts of oop-2
 
Java Fundamentals Of Computer Science Using Java
Java   Fundamentals Of Computer Science Using JavaJava   Fundamentals Of Computer Science Using Java
Java Fundamentals Of Computer Science Using Java
 
Languages used by web app development services remotestac x
Languages used by web app development services  remotestac xLanguages used by web app development services  remotestac x
Languages used by web app development services remotestac x
 
Cs8392 oops 5 units notes
Cs8392 oops 5 units notes Cs8392 oops 5 units notes
Cs8392 oops 5 units notes
 
Java OOP Concept
Java OOP ConceptJava OOP Concept
Java OOP Concept
 
Java object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - BrainsmartlabsJava object oriented programming concepts - Brainsmartlabs
Java object oriented programming concepts - Brainsmartlabs
 

Plus de Ganesh Samarthyam

Plus de Ganesh Samarthyam (20)

Wonders of the Sea
Wonders of the SeaWonders of the Sea
Wonders of the Sea
 
Animals - for kids
Animals - for kids Animals - for kids
Animals - for kids
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
 
CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”
 
Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't Enough
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief Presentation
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - Poster
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship Deck
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz Questions
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quiz
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Oop Article Jan 08

  • 1. Insight Insight On the Notion of Object-Oriented Programming This article discusses the fundamentals of object orientation, and in the process dispels some myths about it. 98 JANUARY 2008 | LINUX FOR YOU | www.linuxforu.com CMYK
  • 2. Insight bject-oriented these features and still can be the problems that may need O progFramming (OOP) has been the most popular programming paradigm for more than two decades and has been the subject of active research for quite considered as a good OO language. An example of flawed arguments I recently heard the following argument: “Java is better than C++ multiple inheritance can be rewritten using only single inheritance (possibly with some difficulty). Because of such reasons, a language designer can make a design decision to support some time now. because Java is a ‘pure’ object- or not support multiple inheritance With such widespread use, we oriented language. Java allows no in her language. However, just would expect the essence or basic global variables, it has a common because an OO language supports tenets of OOP to be widely known Object base class, and it does not multiple inheritance we cannot to students and practitioners. support multiple inheritance and so label it as a ‘bad’ language. However, the essentials are not on. But C++ is a bad object-oriented As Paul Weiss wisely often understood or followed well in language because it supports commented: “It’s one thing not to practice. By just programming in an procedural programs, has no see the forest for the trees, but object-oriented language does not common base class, supports then to go on to deny the reality of necessarily mean that we do that multiple inheritance, etc.” the forest is a more serious task well. In this article we will look I like both Java and C++, but matter.” at the fundamentals of object that aside, let us analyse why this orientation and try to understand argument is inherently flawed. Characteristics and benefits why it has become so successful. Just because we believe that Java OOP is based on the solid We’ll also dispel some myths and is a ‘pure’ OO language, it need not foundation provided by the face some hard facts about OOP be better than C++. Why is ‘pure’ concepts of inheritance, technology. object-orientation better than any polymorphism, abstraction and other approach (like the multi- encapsulation. The basics paradigm approach in C++)? What An abstract data type provides What is object-oriented are the criteria for concluding us with the ability to think of a programming? Hanspeter whether a language is ‘pure’ or type in its abstract interface level Mossenbock’s Object-Oriented ‘impure’? Doesn’t Java’s support and use it depending on its Programming in Oberon-2 of C-style conditional and looping interface only (without concerning [Springer-Verlag, 1993] provides the constructs, and primitive types ourselves with the implementation following definition: “Object- make it ‘impure’? Just because a details; otherwise, there is nothing oriented programming means language also supports other ‘abstract’ about an ADT). Since programming with abstract data paradigms doesn’t mean that it is a OOP is based on the solid types (classes) using inheritance bad OO language. foundation provided by and dynamic binding.” This makes it Providing a common base class is abstraction, it is possible to create clear that OOP is about using ADTs a design decision that a language complex software that hides a lot with inheritance and virtual designer makes in an OO language. of implementation details. Because functions. Based on information and category of this, object orientation is Many of the attributes we theories, many researchers have suitable for programming on a often associate with OOP aren’t supported the argument that having large scale. inherently associated with this a common class as a base class for all Inheritance is the mechanism definition. Strictly speaking, the classes is unnatural and a non- in which common properties of having a common base class (say, intuitive design. various classes (or objects, in case the object class), or language Inheritance is one of the of object inheritance) are features like namespaces, fundamental features of OOP. A abstracted and provided in exception handling, RTTI (RunTime language without any form of common base classes, thereby Type Identification), reflection, inheritance support cannot claim to creating relationships between operator overloading, function be an OOP language. Multiple related types. Inheritance is overloading, etc, are nothing to do inheritance is just one kind of important for design since it helps with OOP, as such. However, many inheritance and it is common to see to organise classes in terms of the modern OOP languages (like Java) it in use (for example, a two-in-one natural relationship between the have a lot of these features, which set inherits the properties of both a types. In inheritance many of the doesn’t mean they are tape-recorder and a radio). details of the derived classes will characteristics of object orientation Practically, it is difficult to use only be known later in the design itself. A language can have none of multiple inheritance correctly, and stage. Also, because of the www.linuxforu.com | LINUX FOR YOU | JANUARY 2008 99 CMYK
  • 3. Insight classification of related types, we background, it takes more time With OOP we can write can write code for general types to learn the object-oriented generic, reusable components (instead of code that works or approach than to learn the and sell it independently. assumes specific types). This gives language features. rise to runtime polymorphism where Object-oriented programs are Partially true! One of the late binding of actual methods for typically more difficult to understand fundamental benefits with OOP is the code is resolved. With than their procedural equivalent. the ability to write reusable code, inheritance (and runtime For example, to understand how but OOP hasn’t delivered fully in the polymorphism), it is easier to to use a derived class, we need to go writing and distributing of generic introduce new changes and extend through the public members of that reusable code, in practice. Writing the software with new types without class and also the public members COTS (Components Off The Shelf) affecting the rest of the code, so of all of its base classes. The effort software is still not fully possible OOP programming required to understand and make with OOP. The emerging areas of enables writing extensible software. use of class libraries, frameworks component software and generic Object orientation also enables or inheritance hierarchies is programming paradigms address providing abstract or concrete considerable. this shortcoming of OOP. classes as libraries and related Object orientation provides a classes as frameworks; instead of higher level of abstraction from OOP emerged based on solid (re)writing classes every time, low-level details and it provides theoretical foundations. we can reuse the classes. So features to model higher-level object orientation helps writing relationships between classes. This False! Unlike programming reusable software. flexibility also comes with some paradigms like functional So the ability to handle complex loss of efficiency compared to programming, which is based on code (enhanced maintainability), straightforward procedural lambda calculus and emerged from the ability to extend the code constructs. For example, to extensive academic research, based on specific requirements support runtime polymorphism, an object orientation came into later (extensibility) and the ability extra level of indirection is needed practical use first and was later to use or reuse the code to invoke a virtual method. In other subjected to extensive research. (reusability) are the main benefits words, a virtual method call is Theoretical understanding of promised by OOP. almost always slower than a direct many of the areas on OOP is still method call. Such additional hazy and OOP continues to be a Costs and drawbacks overhead for abstracting low-level subject of active research. OOP is not a panacea for the details is known as an abstraction problems faced by the software penalty in OOP. It takes time to master industry today. With more than object-oriented programming three decades of experience in Some myths and realities and design. using object-oriented programs, the We will encounter many myths hype and over-enthusiasm in associated with OOP. Let us check True! It is easy to understand promoting object orientation has the validity of some of them here. the basic tenets, features and ideas subsided and the costs of object- of OOP. However, it takes oriented programming are clear. Software written in OOP is considerable time to master the Object orientation requires a better than non-OOP software. analysis, design and implementation new way of thinking (different from techniques to create quality procedural thinking), and it is False! While it is true that OOP solutions using object-oriented difficult to comprehend object- provides significant help in creating technology. As they say, nothing oriented programs. Since object quality software, the quality of the good ever comes easy! orientation provides a higher level software we create is in our hands, and of abstraction from machine-level good or bad software has nothing to do By: S.G. Ganesh is a research details, there is some loss of with OOP. We can write high-quality engineer in Siemens (Corporate efficiency (compared to procedural code in other programming paradigms Technology). His latest book is “60 programs). (like functional programming); Tips for Object Oriented The benefits of OOP aren’t similarly, we can also write sloppy Programming”, published by Tata- automatically available to programs code following OO approach. So, it is McGraw Hill in December this year. written in the procedural way— incorrect to make claims like: “My You can reach him at by just using OOP constructs. software is better than your’s because sgganesh@gmail.com For programmers with a procedural mine is OO whereas yours isn’t!” 100 JANUARY 2008 | LINUX FOR YOU | www.linuxforu.com CMYK