Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl Elitist Code vs Functional Code

by eyepopslikeamosquito (Canon)
on Aug 11, 2012 at 02:01 UTC ( #986847=note: print w/ replies, xml ) Need Help??


in reply to Perl Elitist Code vs Functional Code

You wrote it in 10 minutes its under 50 lines and it performs the function you wanted it to do.
Your program is successful, so its users ask for enhancements and new features, so you add another 50 lines, and another, and another ... your little program grows to be so successful that it becomes critical to your company ... and then you leave the company.

For small throw-away scripts, written by and for a single person, your approach is fine. But it doesn't scale, especially for production software maintained by teams.

Moreover, in my experience, small throw-away scripts, especially successful ones, have a way of growing into thousands and thousands of lines of critical functionality. This sort of code tends to be fragile and difficult to maintain. Yet since the code "works", getting approval to improve its design and maintainability can be problematic (where is the ROI in rewriting a working system? changing the code risks breaking critical functionality, especially likely without unit tests). This topic is touched on in Unix shell versus Perl.


Comment on Re: Perl Elitist Code vs Functional Code
Re^2: Perl Elitist Code vs Functional Code
by patcat88 (Deacon) on Aug 11, 2012 at 04:10 UTC

    Following certain J language best practices. 1000s of classes. No method may be longer than 25 lines. Inheritance charts that must be printed on the DesignJet. Abstraction for the sake of making work. Public properties are forbidden. No flags or options permitted, only derived classes. All getters and setters methods. Main logic placed in exception handling. No documentation of course. The guy who made the API will have a job for life, after he is fired he will be rehired as a consultant for 4x more. Since nobody can sit down and use his code without years of reverse engineering. A very smart programmer indeed.

    Don't invest time in elaborate APIs and abstraction unless you have already have a plan for future improvements which are only limited by funding or minor business model demands at the moment. If you can't whiteboard the plans on why you need abstraction, you dont need it. If you are metriced by the line, go with all the OOP fluff and keep adding classes. If you are paid by the project, go functional with the least amount of typing to get the job done. Nothing I said says to copy code instead of proceduring it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2014-09-22 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls