![]() | |
#1
| |||
| |||
|
|
You are correct in saying that myInvoice.write shouldn't compile ... and even if it did would generate a runtime error as myInvoice doesn't exist. The subroutine based equivalent would go merrily away and corrupt the database. OpenQM are adding some OO based sytnax to the code to what looks like good affect (I should note here that I've not used the OO in OpenQM but have read discussions and descriptions). Being able to at least build and use objects is a start - and for me the key starting point! So, I would disagree that we won't see OO in databasic... Whether people will use it is another issue! As others have commented, many won't use it because that will "lock" them to OpenQM. I find this a little sad, as MV generically won't move forward - I don't ever see a MV standards committee ever being reformed to ensure that all MV products implement stuff like this in the same way.... Agreed. |
|
1) All the code relating to loggings (both its implementation and points of invocation) are scattered throughout your system. |
|
(2) Code in other parts of the system (e.g. order cancellation, file writing, and so on) are now tangled up with code relating to logging - |
#2
| |||||||||
| |||||||||
|
|
Rather than blindly go down the road that OOP, which, after all, has been the purview of non-application-specialists (aka computer scientists) who have only a tenuous, abstract and somewhat adversarial connection with reality, I'd rather see the following. 1- Syntax. Allow the use of properties and methods with the ubiquitous ".xxxx" |
|
2- What is the major advantage of the class structure? Has been explained before - the inheritance, re-instantiation, etc. Let me agree that there is merit to this. |
|
The example given by Anthony (as many) on logging is a classic use of a hammer to kill an ant description. He says: 1) All the code relating to loggings (both its implementation and points of invocation) are scattered throughout your system. |
|
(2) Code in other parts of the system (e.g. order cancellation, file writing, and so on) are now tangled up with code relating to logging - which is not their primary concern. Eh? How is adding a call to the logger "tangling up"? |
|
3) That said, what would be the major advantage of such a structure in the mvBasic world? |
|
So the classes in this new mvBasic should follow the lead of what's there- the Dictionary definitions. Why would you want to "code" the class definition in*each program* when you can "code" it once? |
|
This one fact - having to define things in programs (in the context of business data processing) is where I totally disagree with a lot of what's going on here. |
|
We don't need the OOP constructs in the program, we need to define and enforce them in the Dictionary. |
|
5- OpenQM objects are not, I suspect, anything like this, from the QMBasic docs I read. It is not clear to me whether you can establish any link to a Dictionary type definitio without going through an elaborate class definition (Read method calls a subroutine which you have to code, for example).I may be wrong. |
#3
| |||
| |||
|
|
It's true that something as "simple" as logging can be put into a common subroutine, but there really is a lot more flexibility in a class/object. I know this becaue I'm currently implementing a "logging" class in QM right now. While there is basically only one method, "WriteLog", there are a number of properties to control many aspects of the logging. Doing this with a subroutine would not only require the passing of many parameters, but would require passing them every single time you called the subroutine. With the class, this "state" data may be set only once, because it is maintained througout the lifetime of the logging class. |
|
We don't need the OOP constructs in the program, we need to define and enforce them in the Dictionary. While I think your idea has value, I just don't think the dicts can provide enough. |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| ||||
| ||||
|
|
The simple solution is to create a common work variable (e.g. WORKVALUE) then use that to pass all properties via an array. |
|
This overcomes your hesitation |
|
and keeps everything really simple. |
|
also has the advantage that you can change the number of variables passed without affecting any other calls to the log program. |
#7
| |||
| |||
|
|
Completely different response than my other one in this thread (also banging this one out and hoping it makes some sense): I also see that when people talk about object orientation, that it's commonly assumed that objects directly correspond to files, which is why we see notes related Dict items to field references. Of course it's nice to refer to a file item as an object, but true object orientation needs to extend beyond the confines of how data is physically stored on disk. For example, getting Order Detail is not a function/method which should be implemented on an Order Header record. When you create an Order class, it may get its data from OrderHeader and OrderDetail files, as well as the Customer file, Products, Terms tables and elsewhere. Most apps don't have both Header and Detail files _plus_ a higher level Orders file which coordinates the others. So an Order is really an abstraction, a Business Object, which encapsulates other object types which are in fact defined by dictionaries. Any attempt at object orientation needs to include provision for this sort of higher-level business object, and not rely too heavily on the dictionary as the base for its properties. FYI: mv.NET is being enhanced to generate business object classes, a tedious function commonly done by hand. Higher-level classes will still probably need to be done by hand. Another reason why I make this distinction... When people talk about object orientation related to Pick code, we see examples like Customer->Name = "Joe" Customer.Write etc What we don't see too much of is recognition that fundamental coding principles need to change when one starts objectifying ones code. For example, current order entry code will read existing orders, allow data entry, file the header and detail items, update the customer master, update product available quantities, and perhaps handle billing, shipping, forecasting, and other functions. An object-oriented application wouldn't do this. Each object is responsible for its own business function - your order entry people don't assemble goods on the shop floor, pull stock, drive the trucks, and negotiate with vendors too, do they? No, each object is given just as much info as required and the responsibility is delegated for them to accomplish their task. This is where design patterns and coding habits become as much a part of OOP as the syntax we use. If you're using OO syntax in linear/procedural logic then you aren't really accomplishing much, and you certainly aren't making your application any more attractive to OO programmers that you hope to attract to our market or some specific project. Regards, T |
#8
| |||
| |||
|
|
Of course it's nice to refer to a file item as an object, but true object orientation needs to extend beyond the confines of how data is physically stored on disk. For example, getting Order Detail is not a function/method which should be implemented on an Order Header record. When you create an Order class, it may get its data from OrderHeader and OrderDetail files, as well as the Customer file, Products, Terms tables and elsewhere. Most apps don't have both Header and Detail files _plus_ a higher level Orders file which coordinates the others. So an Order is really an abstraction, a Business Object, which encapsulates other object types which are in fact defined by dictionaries. |
|
Any attempt at object orientation needs to include provision for this sort of higher-level business object, and not rely too heavily on the dictionary as the base for its properties. |
|
What we don't see too much of is recognition that fundamental coding principles need to change when one starts objectifying ones code. For example, current order entry code will read existing orders, allow data entry, file the header and detail items, update the customer master, update product available quantities, and perhaps handle billing, shipping, forecasting, and other functions. An object-oriented application wouldn't do this. Each object is responsible for its own business function - your order entry people don't assemble goods on the shop floor, pull stock, drive the trucks, and negotiate with vendors too, do they? No, each object is given just as much info as required and the responsibility is delegated for them to accomplish their task. |
#9
| |||
| |||
|
|
Bill H wrote: and keeps everything really simple. but cannot ensure consistency throughout the codebase. also has the advantage that you can change the number of variables passed without affecting any other calls to the log program. Of course this would entail updating your logger subroutine to handle these new variables. The same is easily achived with a logging class. New properties are added to the class and one does not have to worry about updating existing code that calls the class with existing properties. No difference. However, maybe a logging class wasn't a good example to support the idea of classes/objects. Anything you can do with classes/objects can probably be imitated to a degree with existing methods in many MV BASIC systems. I don't think the issue is trying to prove that classes/objects let you do things that you can't already. I think what classes give you is a different approach to development that *can* be more elegant, efficient, and results in code with better asthetics. Of course, this is entirely subjective. The same could be said of CASE statements vs IF/THEN/ELSE :-) -- Kevin Powick |
#10
| |||
| |||
|
|
Rambling thoughts. Simon Verona" <nomail (AT) nomail (DOT) zzz> wrote in message news:44acc409$0$3540$ed2619ec (AT) ptn-nntp-reader01 (DOT) plus.net... You are correct in saying that myInvoice.write shouldn't compile ... and even if it did would generate a runtime error as myInvoice doesn't exist. The subroutine based equivalent would go merrily away and corrupt the database. OpenQM are adding some OO based sytnax to the code to what looks like good affect (I should note here that I've not used the OO in OpenQM but have read discussions and descriptions). Being able to at least build and use objects is a start - and for me the key starting point! So, I would disagree that we won't see OO in databasic... Whether people will use it is another issue! As others have commented, many won't use it because that will "lock" them to OpenQM. I find this a little sad, as MV generically won't move forward - I don't ever see a MV standards committee ever being reformed to ensure that all MV products implement stuff like this in the same way.... Agreed. Rather than blindly go down the road that OOP, |
|
which, after all, has been the purview of non-application-specialists (aka computer scientists) who have only a tenuous, abstract and somewhat adversarial connection with reality, |
|
I'd rather see the following. 1- Syntax. Allow the use of properties and methods with the ubiquitous ".xxxx" syntax. This is an innocuous step towards appearing to be in synch with "modern" languages. I say this because it will make the new breed of programmers comfortable and remove one of their complaints, not because it makes life easier. If anything, those of us comfortable with the period as part of a variable will have a learning curve. But just like everything else in the world, appearances are everything. So eliminate the first visual roadblock to modernity. 2- What is the major advantage of the class structure? |
![]() |
| Thread Tools | |
| Display Modes | |
| |