[thelist] programming info
Ian Anderson
ian at zstudio.co.uk
Fri Apr 21 10:16:39 CDT 2006
Andrew Kamm wrote:
> The other things that helped me were repetition (of course), and when
> learning something new, intentionally trying to remember proper syntax
> rather than constantly relying on a reference. If you're not sure about
> something, try to code it, then go back to see if you did it right.
I do that too, but more for adding a little spice to the day than for
any worthy reason!
Guessing method and property names is a good way of passing the time
(often without achieving much, of course...)
Another fun game is to see how many lines you can write without
executing them, and have them work first time...
I think I could score about 4 - possibly less...
I used to compare coding with being slapped in the face repeatedly with
a large, wet fish.
Do a bit - test - SLAP!
Bugger. Fix bug.
Test - SLAP!
Sod it. Fix bug.
Test - WOW, IT WORKS!
Do a bit - test - SLAP!
It's like a drug - the high you get from the thing finally working is
just awesome. Does anyone else do a little booty dance at this point?
Turning up the signal a little, I think a very important thing to learn
is consistency and code reuse.
Consistency - always name your recordsets, database fields, variable and
function names according to a strict, repeatable, predictable pattern.
This way you spend more time writing code and less time scrolling
through files trying to see what something is called, because you can
predict accurately what it's called without having to look.
If your language is case-sensitive, always maintain consistent
conventions for case - likeThisPerhaps() Whatever the convention you
choose is, stick to it like gum on a carpet.
Always do things the same way on every page. Use existing, tested code
where possible.
Always think, how can I reuse this code? Make it a function. How is it
specific to the current situation? Remove those bits to parameters that
are passed into the function.
The aim for us amateur coders should be to build up libraries of "black
box" functions that take consistent input and produce a consistent
output. Then the next time you need the same thing again, you just pop
the function into an include file and call the function from the
relevant place.
We're never going to be proper object oriented programmers, but we can
still work for modularity and code reuse.
This is one reason why I wrote my web application, Snippetz.net (see
sig). Because I want to have access to such snippets from any machine
I'm using - I use three machines on a regular basis not counting
machines on client sites - I wanted a private, web based code
repository. Private because I don't want to expose my less polished
code to public scrutiny, and because some of it is the intellectual
property of my clients.
Having reached a certain (in)competence in the languages I work with,
the face-slapping fish is not such a large feature of the experience any
more. One of the nicest things about the last few years has been the
accelerated learning curve when I have tackled new languages. It took me
a couple of years to become in any way proficient in ASP VBScript; but
learning PHP to the point where I could be dangerous took just a week,
because the design patterns you learn for solving particular problems
don't change, just the way you express yourself.
Of course, there are new gotchas to learn but that's what makes learning
new stuff fun.
Coding is lovely, especially as an antidote to stress.
--
zStudio - Web development and accessibility
- http://zStudio.co.uk
Snippetz.net - Your personal, private code library
- http://snippetz.net
More information about the thelist
mailing list