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

Re: Re: Re: OO: Leaving a constructor midway?

by jest (Pilgrim)
on Oct 22, 2003 at 19:59 UTC ( #301347=note: print w/replies, xml ) Need Help??

in reply to Re: Re: OO: Leaving a constructor midway?
in thread OO: Leaving a constructor midway?

Silly question, but: what's the difference? I mean, I see that there's a difference behind the scenes, in that this suggestion involves calling a separate constructor that really does bless the object, and then does the login business etc. But from the point of view of the user, it's the same: you call some method (whether called "new" or "startup"), and either bounce to a different program, or get back an object blessed into MyPackage. After all, you are the one who so recently said to Abigail-II that if I call a method and get back something that quacks like an object, it's a constructor, so....

If this version makes the OO gods smile upon me, I'm happy to go with it, but I'm just curious. Several people seemed to react with horror to the idea of a constructor exiting the program, so IDG why it's not a horror to having a constructor-like thing exiting the program.

  • Comment on Re: Re: Re: OO: Leaving a constructor midway?

Replies are listed 'Best First'.
Re: OO: Leaving a constructor midway?
by dragonchild (Archbishop) on Oct 22, 2003 at 20:12 UTC
    The difference here is that startup() wraps the constructor. That constructor is still (possibly) available to the client. This is an important distinction. This is (kinda) how DBI does it. Now, DBI's constructor(s) are not visible from the outer-most client, but it is used by the DBD:: class that DBI is providing a connection through.

    Now, DBI is a pathological example, cause it does so much more than just provide an object. But, I think you get my point.

    Also - who cares if the "OO gods" smile on you. It's your code, you have to maintain it, and you're the one who has to look at yourself in the mirror. If you're happy with it, the the heck with everyone else.

    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    ... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2022-01-26 22:13 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (70 votes). Check out past polls.