Page 1 of 1
Spacelists
Posted: Wed Nov 22, 2017 10:15 pm
by lendart1975
Hello.
I wondered if anyone could provide me with an idea of the pro's and con's of using spacelists in VL compared to a data object?
Many thanks
Re: Spacelists
Posted: Thu Nov 23, 2017 8:32 am
by MarkDale
There are some comments in the documentation, under Create_Space
http://docs.lansa.com/14/en/lansa015/co ... _space.htm
The advantage of using a SPACE is that they are very very fast, if you need to repeatedly access data and update it, in memory.
The disadvantage is that it does not work on the web client, (or in RDML on the IBMi). (I have not tried it in a server module).
Re: Spacelists
Posted: Thu Nov 23, 2017 5:39 pm
by Stewart Marshall
It really depends on what you're think of using them for.
If you're manipulating large volumes of data in something akin to a typical batch process, space lists are very handy because they're quick. They are however nothing more than set of dumb variables.
If you're building a complex UI made up of many parts, with lots of user interaction, using data objects is without doubt best practice. Data objects remove much of the complexity of the UI code by wrapping up the rules and behaviour of your data in an object that provides properties, events and methods, meaning they can be reused easily. They are also far superior at managing complex object types e.g. The IDE uses a File object with has Fields which have rules which have ranges and so on. When something in the object changes an event is fired. This can be detected by any part of the application and dealt with accordingly.
Defining a data model takes time up front so it can feel counter productive, however, the benefits far outweigh the effort in making the model. The result of using a data model is far cleaner code that is more consistent and far simpler to maintain.
Regards