[Bluej-discuss] Objects example
chris huston
digger4445 at gmail.com
Sun Apr 23 19:16:15 BST 2006
Hello,
I hope I can post this message here.
I have a question that I hope can be answered. I have a been programming
in Cold Fusion and PHP for many years, using includes and components.
I've always wanted to learn the Object method of programming but up till
this time [10 years +], I haven't found a decent resource that lets me
visualize the methodology. Blue Jay almost gets me there.
My experience has been that if you need to call a "chunk of code" create a
self contained function that you can use [in a central function file],
instead of rewriting it over and over again. This has been that closest I've
gotten to "Pseudo" object coding practices.
I still can't see how object coding clearly.
If someone could help me with this example using the "blue jay way" of
thinking. I would be extremely thankful.
Example----
project: Building
class:residential
method:
createApt(int windowQty, int roomBedRoomQty, int bathroomQty, int patio)
method:
createStudio(int windowQty, int bathroomQty)
class:commercial
method:
createOffice(int windowQty, int seatingQty)
method:
createRestaurant(int bathroomQty, int seatingQty, boolean bar)
class:utility
method:
createStorage(boolean sink, boolean lockers)
method:
createCarpark(int level, string sqrFootage)
My first option would be create a class for each type of space that may
appear in the building [above]. My second option would be to create a class
called space, initially ask for the space type [residential, commercial,
etc.] then call another class with case statements that would roll through
each parameter. Which method would be most future - expandable, and Correct
[object wise].
Does this "high-level" building code look correct... would there be another
way to display a building in the object metaphor?
Thank you for your time..
chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20060423/021ac6dc/attachment.html
More information about the bluej-discuss
mailing list