+7 (495) 987 43 74 ext. 3304
Join us -              
Рус   |   Eng

Authors

Yarmukhametov Ph.

Degree
Undergraduate, Department of System Modeling and Engineering Graphics, Moscow Aviation Institute (National Research University)
Location
Moscow
Articles

Using «Abstract factory» pattern in implementation of validation and data-transformation module of BlockSet interpreter software

The article considers the architecture of validation and data-transformation module used in BML interpreter. BML is declarative modeling domain-specific language created by authors for web-developing. The article discusses about theoretical basis and practical implementation of Block element. Definition of the architecture class inheritance and search for a universal solution are considered for writing the corresponding module using some design patterns one of them is «abstract factory». The pattern allows making of universal architecture of Block class. There is a problem related with Block nature. The block can be declared in BML language with different data types, so that data must be validated and transformed in different ways. In case of integer data type we need to check that it has only digits, but string type has no limits with allowed characters. The string consisted digits in integer type should be converted to number by internal algorithms. So, we need to develop architecture with universal input with different ways to process data depended on their type. The solution of using the «abstract factory» pattern is the best way to that task. Authors developed abstract class named «Block» with virtual methods and different concrete classes for each block of different data type. Each concrete class has a standard set of methods inherited of abstract class.
Read more...