Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^7: Depends...

by hardburn (Abbot)
on Dec 02, 2004 at 18:01 UTC ( #411890=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://411890]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2020-01-23 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?