Google


   


You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson11.Advanced Object Oriented Design > Understanding Encapsulation

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

Understanding Encapsulation

A basic principle of object-oriented design is encapsulation, which means that a class hides the internals while providing a robust and flexible public API (meaning properties and methods) by which it can interact. The benefit of good encapsulation is flexibility and scalability. When one class can peer into and interface directly with the code of a different class, it makes for very rigid designs. If any part of a class's internal code changes, it could potentially break the entire application in such a scenario. However, when all classes interface only by way of a public API, as long as the public API remains the same, the internal code of the classes can change without necessarily breaking anything. That means greater flexibility.

Although the basic principles of good encapsulation are fairly obvious and even intuitive, there are some common errors that programmers make with regard to encapsulation. Those common errors generally involve absolute references within the class such as _root or _global. Although there are exceptions, it is very unlikely that _root or _global should appear within a class.


SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson11.Advanced Object Oriented Design > Understanding Encapsulation


ADBRITE ads links
   
Related tags







Popular Categories
Unix books and guides

AJAX popular information
C# language guides
Windows books and cookbooks

.......








Business Key Top Sites

be number one
rate your site




    С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.

    Русский Polski Francais Deutsch
    support sitemap terms

© CodeIdol Labs, 2007 - 2009