Subject: Re: What constitutes simple code? (Was:: [tcphp]
Simplify a function?)



Wow,

I really started a thread here.

First off I would like to thank everyone for their input on my original inquiry. Simplification, in my expectation, was taking the 14-line function down to as few as possible and Benjamin Holmberg got me exactly what I needed.

Now so that I can weigh in on the offspring of my inquiry.

IMO simplified code does not have to be easy to understand or have documentation. In fact, I try to have as few lines of code in my software as possible. But I own my code and don't use anyone else on projects directly. But I see the reasoning for joint and open projects to have the documentation, absolutely. I've had to use that a few times over the last few years.

But Simple code can really just mean FAST code. I have some scripts that I need to rewrite that I wrote years ago that are 3000+ lines long and, depending on the directory it is parsing, takes seconds to hours to complete. So it's really six of one and a half dozen of the other.

--
Ryan

Erik Giberti wrote:
But why not $a++; in that instance?

I had a CS instructor who hated ++ because it wasn't clear what you were asking the machine to do.

Consider: $A = $A + 1;

If your reading it as, "variable A equals variable A plus 1," you would be checking for truth, which of course is incorrect and illogical hence why folks with a mathematical background hate it. It is fundamentally clearer if you read the statement as, "variable A gets the value of variable A plus 1." A habit I learned from Pascal which uses := for assignment. It more accurately reflects what your asking the system to do.

As a programer, our job is often to translate (as Warren J said) from the real-world into the programming world. Sometimes the real world is just as obtuse but we're employed as the tour guides bridging the gap not to critique the differences.

Erik

On Jan 4, 2008, at 10:50 AM, mike schrenk w...

rote:

I know that math people hate lines of code that look like this:
$a = $a + 1;
Which, of course, is mathematically impossible.

As we all know: $a+=1; is not only correct but more readable =)

--schrenk,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]

Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines

The tcphp.org mailing list is sponsored by pajunas interactive, inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]

Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines

The tcphp.org mailing list is sponsored by pajunas interactive, inc.






Programming list archiving by: Enterprise Git Hosting