The Artima Developer Community
Sponsored Link

Java Buzz Forum
Learning About Object Oriented Programming: Big Words, Easy Concepts

1 reply on 1 page. Most recent reply: Dec 30, 2007 7:54 AM by Tony Marston

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
News Manager

Posts: 47623
Nickname: newsman
Registered: Apr, 2003

News Manager is the force behind the news at Artima.com.
Learning About Object Oriented Programming: Big Words, Easy Concepts Posted: Dec 27, 2007 3:33 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by News Manager.
Original Post: Learning About Object Oriented Programming: Big Words, Easy Concepts
Feed Title: Focus on Java
Feed URL: http://z.about.com/6/g/java/b/index.xml
Feed Description: java.about.com's Focus on Java
Latest Java Buzz Posts
Latest Java Buzz Posts by News Manager
Latest Posts From Focus on Java

Advertisement
Inheritance, polymorphism, and encapsulation These terms sound complex, but they are really just big words that describe some simple concepts. Inheritance is just what it sounds like: classes can inherit...

Read: Learning About Object Oriented Programming: Big Words, Easy Concepts


Tony Marston

Posts: 37
Nickname: tony32
Registered: May, 2007

Re: Learning About Object Oriented Programming: Big Words, Easy Concepts Posted: Dec 30, 2007 7:54 AM
Reply to this message Reply
> Encapsulation is simply the concept that we should hide
> the inner workings of our class, especially its fields,
> from outside tampering.

This definition of encapsulation is totally wrong. It has nothing to do with data hiding, as explained in the following:

http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html
http://www.itmweb.com/essay550.htm

The correct definition for encapsulation is "The act of placing data and the operations that perform on that data in the same class. The class then becomes the 'capsule' or container for the data and operations." The operations appear as method/function names with a number of arguments/parameters, so the only thing that is actually hidden is the code behind each method - i.e. the implementation. Making variables public, private or protected is totally irrelevant as far as encapsulation is concerned.

This is why those people who say that a class should not contain more than a certain number of variables or methods are also wrong. Either ALL the variables and methods are in a SINGLE class, in which case you DO have encapsulation, or they are split across SEVERAL classes, in which case you DO NOT have encapsulation.

It is no wonder that large numbers of programmers have difficulty in undertanding OOP when articles such as this can't even get the basics right.

Flat View: This topic has 1 reply on 1 page
Topic: Links for 2007-12-18 [del.icio.us] Previous Topic   Next Topic Topic: AirTel Broadband Brings Broadband @ 8 Mbps

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use