AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.06.2007, 23:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
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 Blog bot DAX Blogs 0 13.02.2009 02:05
axcoder: PowerShell + Ax Blog bot DAX Blogs 1 09.01.2009 18:05
axaptapedia: Load Web Documents Blog bot DAX Blogs 1 03.01.2009 23:50
axcoder: AxPath is supported by axaptapedia Blog bot DAX Blogs 0 11.05.2007 10:00

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:26.