|
20.06.2007, 23:13 | #1 |
Участник
|
axaptapedia: OOP
Источник: http://www.axaptapedia.com/OOP
============== Summary: /* Examples */ == Object-oriented programming (OOP) == Object-oriented programming is a programming paradigm that is supported by many programming languages including X++. In fact, there are countless examples of OOP in the standard application. OOP utilises techniques like [[:inheritance]], [[:polymorphism]] and [[:encapsulation]]. This strongly increases flexibility and maintainability. == OOP Concepts == *[[:Class]] *[[:Object]] *[[:Inheritance]] *[[:Polymorphism]] *[[:Encapsulation]] == Dynamics AX == In Dynamics AX, objects are usually created in the base class using a static method called ‘construct'. The construct method usually accepts parameters like table buffers or other types of variables. The construct method acts like an object factory 'producing' objects depending on the input parameters. You might be asking yourself if isn’t it easier to put all the code in one place? That might be the case if you want to produce code in a hurry. Rest asured, this approach might be faster but it is certainly not better. The reason is simple: if code is written in an unstructured manner, finding and solving bugs is more difficult and quite often results in code that is broken in one place when fixing it in another place. This can also occur when using OOP except that it very easy to avoid if the programmer is aware of this. This is one of the many pitfalls that OOP help to solve. With OOP, the code pertaining to a specific purpose is encapsulated in its own class. This means maintaining the code can be done in a specific class only. If the code is changed in a class, sibling classes are not affected but children classes are. If desired, it is simple to propagate code changes to all child classes by changing the code in a single place, the base class. All child classes will automatically inherit the new code. == Examples == The FormLetter class has many child classes. SalesFormLetter and PurchFormLetter are two important ones. The FormLetter, SalesFormLetter and PurchFormLetter classes are abstract, see [[Abstract_classes]]. This means, that they cannot be instantiated directly, only child classed can be instantiated. To use the SalesFormLetter class, call the static construct method and pass it some variables. The first variable in the construct method is a base enum DocumentStatus. This determines which object will be created and returned by the construct method. [[Category:General development]] Источник: http://www.axaptapedia.com/OOP
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Похожие темы | ||||
Тема | Ответов | |||
axaptapedia: Startup Tool | 0 | |||
axcoder: PowerShell + Ax | 1 | |||
axaptapedia: Load Web Documents | 1 | |||
axcoder: AxPath is supported by axaptapedia | 0 |
|