CatLogo
Recent Posts
ASP.NET Model View Controller-(MVC) Framework
Windows Communication Foundation (WCF)
The Top 10 Open-Source Customer Relationship Management Solutions
ASP.NET 3.5 LINQ (Language-Integrated Query)
Search Engine Optimization (SEO) - Targeted Website Traffic, Earning Money, gett
10 Important Tips for a fast loading Web Site
cat Archives
July 2010 (1)
June 2010 (1)
May 2010 (2)
April 2010 (2)
March 2010 (1)
February 2010 (2)
January 2010 (1)
December 2009 (1)
November 2009 (1)
October 2009 (1)
September 2009 (1)
July 2009 (2)
June 2009 (8)
May 2009 (5)
April 2009 (1)
March 2009 (3)
February 2009 (3)
January 2009 (4)
December 2008 (1)
November 2008 (5)
October 2008 (3)
September 2008 (4)
August 2008 (4)
July 2008 (1)
June 2008 (1)
IP,Trademarks,Copyrights and Domains Aggressively Protected by DNattorney.com
Copyright© 2000-2010. All rights
reserved CATT Technologies Ltd.
infocat@cattechnologies.com

OOPS IN PHP: Object Enhancements, Introduction of Advance Features in PHP.

 

PHP makes outstanding support for objects. As Zend claims to have addressed the performance problems involved with object creation in previous versions of PHP released , this is a fact that in itself should encourage  developers to use object-based PHP. New PHP Versions  offers enhancements in a few key areas including object autoloading, visibility ,destructors, class constants, static methods, type hinting, reflection , interfaces, cloning and several magic methods.

Auto loading is a new advance feature implemented in PHP newer versions that provides a way for Programmers to make sure dependencies for a class are in place before using it. If you attempt to instantiate a class that has not yet implement or written ,PHP5 will call the __autoload() function as a last attempt to load the class before throwing an error. Since most Programmer put one class per file, and many classes often depend on another class by using the concept inheritance or encapsulation, Function __autoload() allows you to make sure all the necessary class files are included. While PHP Older versions had constructors, PHP newer versions offers a new features: destructors. Destructors are called when an object or instance is destroyed or all references to class it have been removed. Destructors are implemented in classes by use of the __destruct function. The __construct function has also been introduced and takes precedence over the old-style constructor function. The old style still works, but it is recommended that __construct is used as it takes higher priority than older version.

Greatest advance additions to PHP's support for objects is visibility of modifiers, also known as access modifiers like Public, Protected, Private. Keyword VAR  keyword has been deprecated in newer versions and class variables are now should be declared as public, private, or protected. Public class variables are available whole part of the program. Private variables are only available with the class were it was declared. Protected variables are available to a class as well as child classes implemented for that class, unlike private which only allows within class itself to access the variable data. Methods can be declared as public, private, or protected same like variables, and if no access modifier are declared to a method is assumed to be public as default. Access modifiers allow PHP Developers to programmatically hide the inner logic of one object from another by preventing other objects from accessing class data directly. PHP5 and above introduced  with static keyword. Static methods are called without creating an object instance and calls to static methods are complied at compile time, not at runtime. Static properties are accessed by the :: operator and the special variable $this should not be used for static methods.

In Older versions constant declaration is in C-style syntax, const constant = 'constant value', but a class can have constants variables and access them using self::constant. This simplifies management of constants and keeps them available within the classes they declared, preventing code clutter and conflicts with other constants in the same application that may need the same variable name but a different value in it. PHP newer version also allows type hints in method parameter declarations. If a parameter is given a type hint and an object of the wrong type is passed to it, PHP will generate a fatal error. It would be preferable for an exception to be thrown, but type hinting does at least allow responsibility to be placed in the calling code for making sure the proper data type is passed into a function call. Type hints can be used in any function or method not only for class functions or methods.

In New PHP versions abstract classes and interfaces are also introduced a significant enhancement to the PHP language. Abstract classes and Interfaces allow high level design to be semantically applied to PHP classes concepts. PHP has three special method keywords, final, abstract and virtual, to facilitate the use of inheritance and interfaces. When a method is declared with keyword final, it cannot be overridden or overwritten by the child classes. When a method is declared with keyword abstract, it should be defined or overridden in a child class. When a method is declared with keyword virtual, it may be inherited or overridden by a child class. When used in combination, abstract classes and interfaces enforce high level design throughout all levels of implementation and support properly coded objects.

One of the most important concepts of oops is Object Cloning and Reflection Classes. Object cloning allows the implementation of a magic functions and method, Function __clone() to provide information when clone is called on an object. It provide developers to implement whole copying of object data when cloning without writing any unnecessary messy code. A few more functions are __sleep () and __wakeup (), which can be used conjunction with serialize and unserialize to ensure proper destruction and recreation of resources used within an object or instance . the function __to String method allows a class in using string context. Reflection class works as the name implies; it provide developers to programmatically re-engineering classes, interfaces, functions and extensions. Reflection is a best tool for developing custom application frameworks, CRM and Cms tools.

CAT Technologies has successful in implemented PHP With enhanced oops concepts, CAT was well know software development unit works extensively on oops concept, This  Article posted provides brief description of enhanced oops concepts which is newly implemented in php 5 by which performance of application remain on top with lower risk factor and easy development. CAT implementing this concept in our development process for providing best performance of software application/web application  to satisfy end user needs and make end user use the application in more effective way than Never before.

 

Posted By: D.Kishore Kumar

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)
Name:
Email Address:
Url:
Comments:
  catOpinions