Re: build faster
- From: Jeff <jeff_thies@xxxxxxx>
- Date: Mon, 16 Mar 2009 11:41:57 -0500
Jerry Stuckle wrote:
The Natural Philosopher wrote:Jerry Stuckle wrote:but to create those objects in the first place, I had to create them with not only what I need NOW in mind, but what I might need in the FUTURE
And that is the whole problem. If we knew what the future held..we could plan for it.
Actually, with experience and planning, it's quite easy to make reasonable estimates of what will be needed in the future.
All you can do is very time you find yourself doing the same thing, make it a function. And hive it off into a library file. And fix every occurrence of it to that library function call.
Maybe that's all YOU can do. Competent programmers do much more, every day.
Ditto if you have site specific stuff, a database name, a password. a website URL, a contact details section, the webmaster mail, A logo then put that in a file of global includes.
3rd party libraries are OK, if they have in fact solved the problems that you are having, if they haven't the chances are you will be running a huge overhead of stuff that isn't actually used.
And it may take you longer to learn the library than to recreate those parts of it you actually want.
Cost benefit rules you. Which is faster right now, locating testing and learning the library, writing your own, or just coding from scratch.
A very short sighted viewpoint. Reusable code is NEVER about immediate gains. It is, however, about long-term gains. Writing reusable code will always take more time on the current project. But if done correctly, it will save more than that within the next 2-3 projects.
I agree completely.
In addition to writing reuseable code you should be writing expandable code that is backward compatible. OO makes this easy.
Now I see a lot of work other programmers have done where there is no OO, there often are no functions, this is all embedded calls and includes in html. Perhaps easy to write one/off, but a maintenance nightmare.
Don't try and second guess the future too much. 75% of the time you will be wrong.
A competent programmer can be you can be 90%+ correct on what will be needed.
When we are talking database work, most of this is the same task. That is setting up data to make it editable, viewable and downloadable. Getting data in is always harder than getting it out.
When I first started programming I wrote everything fresh for each project.
Then I wrote a utility that would take a form and extract the fields and write the sql for edits,insert and views. That saved a lot of time.
Now what I do is create a database object with the field names, what type of fields (text, textarea, image upload, select...) and other optional details such as sizes, renaming conventions and thumbnail sizes, ajax editable... That writes the form (which I can modify) and an editable table. I bet most of us that have been around for a while do the same things.
I can expand this as need arises and use the same module to update older projects.
If you aren't writing OO code that can be reused (or even function based) you are writing the same bits over and over and over.
The last bit which is often the hardest because it has no immediate reward, is to document how your object works! Just because you remember a method call now, does not mean you will in 6 months.
Good programmers are lazy. Sometimes you have to put in extra work up front to be lazy later.
Jeff
.Cost on the basis of a complete rewrite from scratch, and if you get lucky, take the profit for the next time you dont.
A competent programmer seldom starts from scratch and has libraries of code which can be used on almost any project (sometimes with modifications, but often not).
- References:
- build faster
- From: hs
- Re: build faster
- From: Jerry Stuckle
- Re: build faster
- From: The Natural Philosopher
- Re: build faster
- From: Jerry Stuckle
- build faster
- Prev by Date: Re: abcphp.com - Discover the best of PHP
- Next by Date: Re: Functions & Classes
- Previous by thread: Re: build faster
- Next by thread: Re: build faster
- Index(es):
Relevant Pages
|