Re: build faster



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).

.



Relevant Pages

  • Library Design, the script kiddies nightmare.
    ... good across the board of assembler programming. ... With languages that have the capacity, libraries of reusable code make ... comes at a cost that some of the older assembler programmers will not ... The virtue of writing code in this modular format is that you can use ...
    (alt.lang.asm)
  • Re: Writing bulletproof code
    ... Good software design requires that you put error ... > the 'C' language and the libraries. ... It doesn't actually solve the problem that programmers are ... very few know when the cost will be negligible ...
    (comp.programming)
  • Re: <ctype.h> toLower()
    ... I konow several real world programmers, ... >> And portability is in most cases a very low priority as in most cases ... > the past 10 years I only wrote some specific platform specific software. ... > libraries did their job well). ...
    (alt.comp.lang.learn.c-cpp)
  • Re: How does Require deal with multiple files of the same name in different directories
    ... This meant that programmers developed their own ... libraries had almost the same functionality they have been merged into ... specific implementation details; hopefully that will be improved as ... to add pre-emptive multi-tasking, to have a separate code ...
    (comp.lang.forth)
  • Re: Writing bulletproof code
    ... >> Efficiency is part of good coding. ... the 'C' language and the libraries. ... >> where most programmers seem to go wrong, ... >> triple checking is more important than efficiency. ...
    (comp.programming)