On 03 Dec 2001 01:43:57PM +0800, fooler ([EMAIL PROTECTED]) said:

> iterative:
>     double factorial;
>     if (n < 2) {
>         factorial = 1;
>     }else {
>         for (factorial = n ; n != 2; factorial = factorial * --n);
>     }

I don't know about you, but I'd have written the iterative factorial as:

int factorial = 1;
for (i = 1; i <= n; i++)
    factorial *= i;

cleaner, you think? ;)

Clean and elegant code has its uses. Maintainability is pretty
important. =) Of course it all depends on the needs of your application
- sometimes a quick hack is called for, sometimes a mission-critical app
must be written - but it doesn't hurt to make sure that the next
programmer who looks at your code can understand it.

Plus, things are easier to debug when you understand it - you know what
a pain spaghetti code can be...

> programmer, they are spending more time on *bones* than the *meat*. or let
> say, who is a good programmer? the one who makes a robust program but gives
> the correct results and meet his/her deadline or the one who makes an
> elegant code that gives the correct results also but it takes time to

But in this particular context, a quick, brute-force solution is easy to
write. =) That's why an elegant solution would be interesting.

Sometimes the bones are very important. <g> It's easy to kludge things
in at the start, but as more and more cruft gets added it pays to
consider the design and maybe refactor code.

I've spent time thinking of designs to try and then sketching them out 
in code. I've also thrown away code and started all over again a few
times. I've even rm -rf'd my project directories in a fit of frustration. ;)

Then again, there are times when I just shoehorn things into existing
programs, and most of the time I still understand what's going on.. =)

It's not a perfect process, but I feel like I learn a lot with
each iteration. I don't know if I work acceptably quickly. When I have a
clear picture of what is needed, like the online project submission
system I'm doing for my school, then I can put together something pretty
quickly. It took me a day to put that together. Of course it took me a
week and a lot of help to figure out that the one bug delaying
deployment was a _browser_ problem! GRRRRR. It works in IE, Mozilla, Galeon.. anything 
but Lynx, Links and Opera. <grumble!>

Then there was that registration system we did. Counterbidded a
Microsoft shop and did it for free... that was _tons_ of fun. Of course
we got a bit of a Slashdot effect and I was working overtime to remove
the bugs I missed, but that was great. We did most of the system in
around 5 days, then just added functionality as needed... <g>

I don't know. I've never worked for money, and you have. You know what 
it's like in the real world. <shrug> As far as I've seen, speed, size,
correctness, robustness and neatness aren't mutually exclusive, although

I've seen code written by Gino and William, and they really try to
make their code neat. It's clean enough for me to understand. =)

I'd like to be an expert programmer. (See extensive literature on
novice and expert programmer). According to some studies, expert
programmers write code roughly an order of magnitude faster _and_
smaller _and_ neater than novice programmers in a tenth of a time.
(Wow!)

Of course these are probably some pretty old studies, but cool goals,
you think? I have much to learn.

I don't know much about software in the real world, I have to admit. I
love programming, and I'd like to do that for the rest of my life - in
addition to doing research and learning about all sorts of cool stuff,
of course. But if the software industry here doesn't care about things
like readability and maintainability, if all that I read in books
and magazines about good software practices are just concerns of geeks
in America and elsewhere - what should I do?

Is this really the state of software here in the Philippines? Probably
elsewhere, too, huh... It's the easy way out. Just slap something
together. As long as it works with the input, it's fine.

I don't know. I want to learn more. I want to practice thinking,
problem-solving, doing.. I want to make writing good code so natural
that I don't have to think about it. Is this at all possible, or am I
chasing a pipe dream?

Anyone out here with similar ideas?
-- 
Sacha Chua <[EMAIL PROTECTED]>                       3 BS CS geek =)
Ateneo Cervini-Eliazo Networks (ACENT) tel: 63(2) 426-6001 loc 5925
BOFH excuse #14: sounds like a Windows problem, try calling Microsoft support
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to