I am currently working on some courses in the Progress Education Community and in the course for Object Oriented I came across something that had me puzzled for some minutes. The thing that confused me was where the course explained interfaces. Take a look at this code:
using Progress.Lang.*. using Inventory.IProduct. block-level on error undo, throw. interface Inventory.IProduct: end interface.
What is the line "using Inventory.IProduct." doing in there? We are defining the interface itself, so why would you want to tell the compiler what to use? I know the Progress compiler is not of Nobel Prize winning quality, but surely you do not need to tell this.
Experimenting in DevStudio tells me that it makes no difference whether you define it or not. If I right-click on the code and choose 'organise Using statements', both using-statements in the above example are removed.
So is it safe to assume that this is just an example of a bad example?
It does not sound that bad to me.... this would require the USING
METHOD PUBLIC LOGICAL Compare (poOtherProduct AS IProcuct): END METHOD .
otherwise you'd have to code:
METHOD PUBLIC LOGICAL Compare (poOtherProduct AS Inventory.IProduct): END METHOD.
What is really bad coding practice IMHO is the lack of a master package (CompanyName.Inventory.IProvduct or com.companyname.Inventory.IProduct)
Hm, now that I add more code I can see that the compiler indeed requires that you tell it to use itself. I imagined that it would be smart enough to find it out by itself.
The ABL does not have any automatic usings ... (like in C# where your own namespace is always there).
Hi Patrick,
The 11.7 version of the course content should have been updated to reflect the fact that the extraneous using statement is not included in the generated course. Prior to 11.7, it was. The hands-on Try Its for this course are correct in that, in the solutions, there are no extraneous using statements.
We will update this with the next revision of the course.
Elaine Rosenberg
Course Developer