Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: module w/ object-oriented and functional interfaces: best practices?

by sundialsvc4 (Abbot)
on Sep 21, 2012 at 18:29 UTC ( #994968=note: print w/replies, xml ) Need Help??

in reply to module w/ object-oriented and functional interfaces: best practices?

Echoing BrowserUK’s comments, and after up-voting his post, I would emphasize that a running, stable application is a very important thing not to be changed lightly.   In my experience it is best to add objects to existing applications, when and where and if that makes sense, and to generally let a sleeping dog lie.

Perl’s implementation of objects is just as pragmatic as the rest of the language.   A constructor routine, with a by-convention choice of name, that returns a blessed (hash...) reference; a fast-and-efficient notion of “blessed,” and the blessed-reference is always the implied first parameter to the function.   This gets the job done simply and efficiently without compelling you to seriously change either your thinking or your code.   (Typical battle-tested Perl wisdom ...)

Yes, the object paradigm (in Perl) is quite useful, because it gives you “a convenient briefcase in which to store your coat,” or anything and everything else that you need to carry around with you, and it makes sure that you won’t misplace it.   Plus, a naturally-simplified calling convention for the clients to use.   Yes, lots of formerly-function based packages did “convert” to an object API, but then again, I daresay that there are other packages that went the other way.   They didn’t do it because someone just felt embarrassed about how the package worked before.

“Best Practice” is, and forever will be, a general guideline ... a frequently-beneficial categorical suggestion, but made by someone who does not know and cannot know your application’s unique situation.   But I would not tamper with what works, just because of it.   Rather, I would permit my application to evolve naturally, trending in this new direction as it makes logical business-sense to do so.

  • Comment on Re: module w/ object-oriented and functional interfaces: best practices?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994968]
[ambrus]: ad code examples.
[ambrus]: I'm not trying to recommend PHP, but I think it has way too bad a name because of its past.
[ambrus]: This is different from MS Word, which was already a good editor in the pre-unicode days (in word for windows versions 2 and 6, which ran on windows 3 but also on windows 95), only it wasn't trying to solve the task of writing maths papers back then.
[Discipulus]: ah ok, sounds reasonable; with no fear: Perl all life long
[ambrus]: Mind you, LaTeX is currently still useful for writing math paper or snippet content without styling in such a way that the
[ambrus]: formatting conventions of a journal or website can be quickly applied to it, and MS Office and LibreOffice has not quite solved this (although it's better for this than it used to be),
[ambrus]: which is sort of a drawback compared to the ages of typewritten manuscripts representing content only to which the typesetter applies formatting, but that process required much more manual labor.
[ambrus]: If you want to typeset a manuscript, you can still do much less work then in the manual typesetting ages and get good formatting.
[ambrus]: All with only cheap modern computers and software.
[ambrus]: Something you can have at home and your corner print shop, without a whole printing press's worth of equipment.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-09-26 11:14 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.