Nesneye yönelik programlamanın rol modelleri ile genişletilmesi

Gerçek dünyada karşılaşılan sistemler durağan ve dinamik olmak üzere iki kümeye ayrılabilir. Durağan sistemlerin aksine, dinamik sistemlerde zamanla değişen ve evrimleşen varlıklar söz konusudur. Bu şekilde zamanla değişen nesneleri nesneye yönelik programlamanın (NYP) sınıf hiyerarşileri ile modellemek zor olacaktır. Bu zorluğun nedeni, dinamik yapıdaki gerçek dünya varlıklarının durağan yapıdaki sınıflar ile modellenmeye çalışılmasıdır. NYP durağan sınıf yapısına dinamizm katacak yeteneklere sahip olmasına rağmen dinamik sistemlerin modellenmesinde karşılaştığı güçlüklerden tam anlamıyla kurtulamaz. Rol modelleri; dinamik sistemlerin nesneye yönelik program-lama ile modellenmesinde karşılaşılan güçlüklerin çözümü için önerilen yollar arasında kullanışlı olmaları, NYP kavramları ile iyi uyuşmaları ve problemin çözümü için dolaysız bir yol sunmaları nedeniyle dikkati çekmektedir. Nesne düzeyinde özelleştirmeye dayanan rol modelleri, sınıf düzeyinde özelleştirmeye dayanan nesneye yönelik programlamayı doğal bir biçimde genişletir. Bu nedenlerle dinamik sistemlerin saf NYP yaklaşımı ile sunulandan daha iyi modellenebilmesi gereksinimini karşılamak üzere, Java programlama diline rol desteği kazandıran bir rol modeli olan JAWIRO (Java with Roles) gerçeklenmiştir. Bu çalışma sırasında rollerin diğer çalışmalarda önerilen özellikleri arasına altı yeni özellik kazandırılmıştır. Bu makalede rollerin JAWIRO rol modeli ile nasıl kullanılabileceğinin anlatılmasına ek olarak, JAWIRO’nun güncel rol modelleri ile rollerin gerçeklenen özellikleri ve çalışma anı başarımı açılarından karşılaştırmaları verilmiştir. Sonuç olarak JAWIRO, sahip olduğu özgün yetenekler ve çalışma anı başarımına ek yük getirmemesi sayesinde dinamik sistemlerin modellenmesi için önemli bir gereç haline gelmiştir.

Extending object oriented program ming with role models

Real world systems can be classified either as static or dynamic. In static systems, entities to be modeled can be divided into distinct classes and they do not change their classes. Such systems can be modeled efficiently by using the object oriented programming (OOP) paradigm as the relationship between an object and its class is persistent, static and exclusive in OOP. On the contrary, dynamic systems contain entities that constantly change and evolve. Modeling such entities with the class structure of OOP is hard because objects of dynamic nature are required to be modeled by classes having static nature. Although OOP has features to add some scale of dynamism to the static nature of its classes, it cannot fully eliminate the obstacles it faces while modeling dynamic systems.When modeling dynamically evolving entities, using instance level specialization will eliminate the obstacles faced by the class level specialization. In that case, a real world entity is represented by multiple role objects, each representing one of the responsibilities of the real world entity. A role of an entity can be defined as the set of properties which are important for an object to be able to behave in a certain way expected by a set of other objects. The programming paradigm which is based on using roles is called role based programming (RBP), while a role model is software which specifies a style of designing and implementing roles. Role models provide a mechanism for object level inheritance while preserving the fact that multiple objects are used to model a real world entity.Role models receive much attention with their usefulness among the proposed ways of modeling dynamic systems as they match with the OOP paradigm well and represent a direct way for solving the problem at hand. Role models which are based on object level specialization naturally extends the OOP which is based on class level specialization. Therefore, we have extended the Java programming language with role support in order to solve the problem of modeling dynamic systems better than the ways available with the pure OOP paradigm. For that purpose, a role model named JAWIRO (Java with Roles) is implemented. Different researchers define the features expected from the roles in slightly different ways. According to our experience, the basic features of a role model should contain the following: • Roles can be gained and abandoned dynamically and independently of each other. • Roles can be organized in various hierarchical relationships. A role can play other roles, too. • An entity can switch between its roles.• A role can access member variables and methods of other roles. • Class level inheritance can be used together with object level inheritance.• Entities can be queried whether they are currently playing a certain type of role or a particular role object. • An entity can have more than one instance of the same role type. Such roles are called aggregate roles and distinguished from each other with an identifier. • Different roles are allowed to have member variables and methods with same names without conflicts. These basic features do not cover all that can be done with roles. JAWIRO implements the following extended features of roles as well, where the last six are the unique contributions of JAWIRO: • Abnormal role bindings are prevented. • Persistence is supported.• Roles can be suspended and then resumed. • A role can be transferred to another owner without dropping its sub roles. • Multiple object level inheritance is supported. • Any public member variable or method of any participant of a role hierarchy can be accessed solely by its name, without a direct reference to its owner. In case of identical names, the most evolved member is returned. • By setting dominant nodes in a role hierarchy, the previous rule can be overridden. • Both consultation and delegation mechanisms are supported.This paper describes how these features of roles are used with JAWIRO and compares recent role models in terms of features and run-time performance. As a result, JAWIRO is surfaced as an important tool for modeling dynamic systems, thanks to its unique contributions to features of roles and its neglible overhead on runtime performance.

___

  • Betini, L., Capecchi, S. ve Venneri, B., (2003). Extending Java to dynamic object behaviours, Electronic Notes in Theoretical Computer Science, 82.
  • Gottlob, G., Schrefl, M. ve Röck, B., (1996). Extending object-oriented systems with roles, ACM Trans. on Information Systems, 14, 268-296.
  • Kristensen, B. B., (1996). Conceptual abstraction theory and practical language issues, Theory and Practice of Object Systems, 2, 143-160.
  • Lee, J-S. ve Bae, D-H., (2002). An enhanced role model for alleviating the role-binding anomaly, Software-Practice and Experience, 32, 1317-1344.
  • Schrefl, M. ve Thalhammer, T., (2004). Using roles in Java, Software-Practice and Experience, 34, 449-464.
  • Selçuk, Y. E. ve Erdoğan, N., (2004a). Java diline ileri düzey rol desteği kazandırılması: JAWIRO, Bildiri Kitabı, Havacılıkta İleri Teknolojiler ve Uygulamaları Sempozyumu, Cilt II, 601-606, İstanbul.
  • Selçuk, Y. E. ve Erdoğan, N., (2004b). JAWIRO: An extended role model for Java, Proceedings, Int'l. Conf. on Computational Intelligence, 207-210, İstanbul.
  • Selçuk, Y. E. ve Erdoğan, N., (2005a). A role model for description of agent behavior and coordination, Proceedings, 6th Int’l Workshop on Engineering Societies in the Agents' World, 227-237, Kuşadası.
  • Selçuk, Y.E. ve Erdoğan, N., (2005b). Using roles with JAWIRO, Proceedings, AAAI 2005 Fall Symposium Series, Roles: An Interdisciplinary Perspective subtopic, Arlington, Virginia.
  • Fowler, M., (1997). Dealing with Roles. http://martinfowler.com/apsupp/roles.pdf, (13.12.2005)
  • Schrefl, M., (2004). The Java Role Package. http://www.dke.uni linz.ac.at/research/projects/roles/index.html, (13.12.2005)
  • Selçuk, Y. E., (2005). JAWIRO rol modeli. http://www.yunusemreselcuk.com/jawiro/giris.html, (13.12.2005)