This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
This person has a SecurePRO™ card. Because this person is not a ProZ.com Plus subscriber, to view his or her SecurePRO™ card you must be a ProZ.com Business member or Plus subscriber.
Affiliations
This person is not affiliated with any business or Blue Board record at ProZ.com.
English to Russian: Zend Engine 2.0 new object model
Source text - English New object model
Notice: the abilities described are available in PHP5 only. Usage is admissible as testing only.
In order to introduce new abilities and increase working speed the objects’ management system in Zend Engine has been changed completely.
In the previous versions objects were managed like fundamental data types (i.e. like whole numbers or symbols’ strings). The drawback of this method is that the whole object was copied completely semantically by value appropriation to an object’s property or by transmitting arguments to its method. The new approach is included in communication with an object through handler not by value (i.e. handler may be presented just as an object’s identifier).
And as far as many PHP-programmers had no idea about copying peculiarities in the old object model there is a great chance for the possibility that applications themselves or after inconsiderable changes done will work much faster.
Secret terms
Secret properties are introduced in Zend Engine 2.0. It should be mentioned that by unapproved access to a secret attribute an error message won’t be displayed in order to evade slowing down of work.
Example 1: Secret terms
Objects’ cloning
By copying objects within Zend Engine 1.0 a user couldn’t decide what exactly the constructor had to copy and what not. Version 1.0 copied an object bit-by-bit and released the complete copy of all its properties by the output.
However absolute copying of an object with complete set of properties isn’t always the thing we need. A good example would be following – you have an object representing a GTK-window and information about all the interface’s elements of this window is also saved in the object. You may need to create a new window which is a copy of the first one and save the data about all the interface’s elements of the new window in the new object. Another variant is following: your object contains reference to another object which is used by the first one somehow. By cloning your parent object you create a copy of other object and thus the duplicate of your object has its own copy of those object used.
An object’s copy is created by method __clone() of this object.
When a developer calls cloning of some object Zend Engine checks if method __clone() has been defined. If it hasn’t __clone() is called on default and all the properties of an object are duplicated completely. If the method has been defined, it enumerates the properties of an object which will be transferred into its copy. For convenience of usage Zend Engine presents a function which imports all the properties of copied into the object: thus they will be in the copy on their meaning and a developer is left only rewrite those properties which he is going to change. [In the given version this function hasn’t been realized yet].
Example 2: Objects’ cloning
Compulsory deletion of objects
Zend Engine 1.0 hasn’t contained any means for compulsory deletion of an object if some references to it existed. Operator delete represented in the new version calls destructor of an object and frees the memory occupied by an object even if there are references on it in the other places of the system. All the references on the object destroyed become out-of-date and all the attempts to become access through them result into a fatal error.
You should take into account that if there is a defined by a user function delete() in your script, such a script will display a parse error in Zend Engine 2.0 as far as ‘delete’ is reserved word from this moment.
Inserted classes (names’ spaces)
Zend 1.0 core provided only three scopes: global scope, class scope and function scope. All the scopes except for classes could contain variables; only class and global scope could contain functions; only global scope could contain constants and classes. This means that in all the versions of Zend Engine 1.0 methods of scope had been limited in order to evade conflicts within names’ space.
In Zend Engine 2.0 new conception of inserted classes is represented in order to solve the problem of name conflicts with alternative method: a possibility appears to define some names’ tables containing any symbols types. Zend Engine always watches in which class area accomplishment is placed setting up the global area on default. Each class may contain its own set of constants, functions and static variables. For access to identifiers within a class a class access operator self:: is used and thus the following string is possible: self::$my_static_name = "Hello". With functions and constants as well the search will be firstly led within the current class if you haven’t defined the class to which they belong and then (if the search has resulted into nothing) the global scope will be examined. If you need to lead search within the global scope only, you may set up this explicitly through the access operator main::. For example, using main::strlen() you may be sure that you call namely strlen() from the global scope. Thus you are to use main:: only in those cases when you create a method having the same name as a global function does. Syntax for access to the constants is the same: self::MY_CONSTANT or main::MY_CONSTANT.
Sometimes you may dislike getting access to constants, variables and classes through access operators (such as MyClass::): you have use them too often and your setting speed is insufficient. In such a case you may import functions, classes and constants from other classes through the key word ‘import’. The name speaks of itself; there are also some examples given below.
Classes may contain other classes
Example 3: Inserted classes
Translation - Russian В целях внедрения новых возможностей и для увеличения скорости работы система управления объектами в Zend Engine была полностью изменена.
В прошлых версиях объекты управлялись как основные типы (то есть как целые числа или строки символов). Недостаток такого способа заключался в том, что при присвоении значения свойству объекта или при передаче аргументов его методу, семантически копировался весь объект целиком. Новый подход заключается в общении с объектом через обработчик, а не по значению (то есть обработчик можно представлять себе как всего лишь идентификатор объекта).
И, поскольку многие PHP-программисты даже и не подозревали о тонкостях копирования в старой объектной модели, есть относительно высокий шанс того, что приложения сами по себе или после незначительных изменений будут работать намного быстрее.
Закрытые члены
В Zend Engine 2.0 вводятся закрытые свойства. Отметим, что при несанкционированном доступе к закрытому атрибуту сообщение об ошибке не выводится: во избежание замедления работы.
French to Russian (Linguistic University Diploma) Russian to French (Linguistic University Diploma) English to Russian (Linguistic University Diploma)
Memberships
N/A
Software
Adobe Acrobat, Adobe Photoshop, DejaVu, Dreamweaver, Microsoft Excel, Microsoft Word
Bio
IT
experience since Jan 2000:
- freelancer since Jan 2000 (IT: software development, project management; law)
- November 2000 - November 2004: translations for USV Ltd. (bicycle frame building)
- March 2001 - June 2001: translation for Regional French Language Center in Nizhny Novgorod
- since November 2001 - translation for www.phpclub.ru (php related articles) http://www.phpclub.ru/detail/author/patrungel
- June 2002 - January 2007 - translator&interpreter for international adoption agency.
Keywords: php, html, programming, c, bikes, frames, engineering, web