in reply to Re^6: Depends...
in thread Review: CGI::Prototype
In my case, "mainscreen" would be misnamed. For one of my projects, it went:
A (mainscreen) -> B (data entry) -> C (dynamic entry in a loop) -> D (preview, with option to go back and edit) -> E (finish, with all data being saved to database)
I'm not saying that C::A can't do this (far from, for I did indeed write the above in C::A), but that the result isn't very clean.
What I want is a subroutine call which decides which state the application is in and returns an object. You don't care what the object actually does, but you are guarenteed that it has certain methods. You take that object, call the methods as perscribed in the API, and eventually get back some HTML to display to the user (or maybe the object did that on its own). Meanwhile, the object takes care of parameter checking and saving things to databases and such.
That's polymorphism. The logic is take care of by having the right objects in the right place, not by conditionals.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
|
|---|