|
|
Subject: Re: What constitutes simple code? (Was:: [tcphp] Simplify a function?) - msg#00028
List: php.tcphp
I tend to think that all code can fall into one of several categories...
simple, efficient, powerful, agile, elegant, scalable, readable, usable,
and useful
The goal with any project is to hit as many of those as possible. But
the reality is, there's often a trade off. Elegant code my not be
powerful. Simple code may not be scalable, and so on.
That's my 2 cents ;)
On Fri, 2008-01-04 at 15:16, Ryan Coleman wrote:
> 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 wrote:
> >
> >> 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:
> > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
> >
> > 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:
> talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
>
> 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.
Brandon Carlson
Zend Certified Engineer
Aphion Inc - Enhancing the web experience, one site at a time
www.aphion.com
brandon-+k24AcDEvnDQT0dZR+AlfA@xxxxxxxxxxxxxxxx
651-204-6424
AIM: bcarl314pi
Yahoo: bcarl314
NOTE: This E-mail is confidential and its contents and any attachments
are private and are intended only for the use of the addressee(s), and
may contain privileged and/or confidential information. If you are not
the intended recipient, you are hereby notified that the use,
dissemination, distribution, or copying of this E-mail and/or the
attachments is strictly prohibited. If there are any non-disclosure
agreements, non-compete, or similar agreements, this message serves as
notice that this email, its contents and attachments are confidential
and privileged and are subject to applicable non-disclosure and
non-compete agreements.
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
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 wrote:
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: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
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: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
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.
Next Message by Date:
click to view message preview
Re: What constitutes simple code? (Was:: [tcphp] Simplify a function?)
The simplest code is that which is not written. Only after I have started
coding does it become complex :)
In all seriousness, I agree with huroye123's list. Once I started getting
into more Object Oriented programming and fully understood the concepts and
how to implement, my code became much more simple.
I'm of the opinion that execution time and "correctness" are of prime
importance. If you can optimize performance and minimize bugs, the
maintainability/readability of your code is much less of an issue that code
that requires multiple patches to fix problems that shouldn't have been
there in the first place.
On Jan 4, 2008 4:45 PM, Brandon Carlson
<brandon-+k24AcDEvnDQT0dZR+AlfA@xxxxxxxxxxxxxxxx> wrote:
> I tend to think that all code can fall into one of several categories...
>
> simple, efficient, powerful, agile, elegant, scalable, readable, usable,
> and useful
>
> The goal with any project is to hit as many of those as possible. But
> the reality is, there's often a trade off. Elegant code my not be
> powerful. Simple code may not be scalable, and so on.
>
> That's my 2 cents ;)
>
>
>
> On Fri, 2008-01-04 at 15:16, Ryan Coleman wrote:
>
> > 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 wrote:
> > >
> > >> 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:
> > > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
> > >
> > > 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:
> > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
> >
> > 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.
>
> Brandon Carlson
> Zend Certified Engineer
> Aphion Inc - Enhancing the web experience, one site at a time
> www.aphion.com
> brandon-+k24AcDEvnDQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> 651-204-6424
> AIM: bcarl314pi
> Yahoo: bcarl314
>
>
>
> NOTE: This E-mail is confidential and its contents and any attachments
> are private and are intended only for the use of the addressee(s), and
> may contain privileged and/or confidential information. If you are not
> the intended recipient, you are hereby notified that the use,
> dissemination, distribution, or copying of this E-mail and/or the
> attachments is strictly prohibited. If there are any non-disclosure
> agreements, non-compete, or similar agreements, this message serves as
> notice that this email, its contents and attachments are confidential
> and privileged and are subject to applicable non-disclosure and
> non-compete agreements.
>
>
Previous Message by Thread:
click to view message preview
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 wrote:
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: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
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: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
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.
Next Message by Thread:
click to view message preview
Re: What constitutes simple code? (Was:: [tcphp] Simplify a function?)
The simplest code is that which is not written. Only after I have started
coding does it become complex :)
In all seriousness, I agree with huroye123's list. Once I started getting
into more Object Oriented programming and fully understood the concepts and
how to implement, my code became much more simple.
I'm of the opinion that execution time and "correctness" are of prime
importance. If you can optimize performance and minimize bugs, the
maintainability/readability of your code is much less of an issue that code
that requires multiple patches to fix problems that shouldn't have been
there in the first place.
On Jan 4, 2008 4:45 PM, Brandon Carlson
<brandon-+k24AcDEvnDQT0dZR+AlfA@xxxxxxxxxxxxxxxx> wrote:
> I tend to think that all code can fall into one of several categories...
>
> simple, efficient, powerful, agile, elegant, scalable, readable, usable,
> and useful
>
> The goal with any project is to hit as many of those as possible. But
> the reality is, there's often a trade off. Elegant code my not be
> powerful. Simple code may not be scalable, and so on.
>
> That's my 2 cents ;)
>
>
>
> On Fri, 2008-01-04 at 15:16, Ryan Coleman wrote:
>
> > 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 wrote:
> > >
> > >> 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:
> > > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
> > >
> > > 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:
> > talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
> >
> > 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.
>
> Brandon Carlson
> Zend Certified Engineer
> Aphion Inc - Enhancing the web experience, one site at a time
> www.aphion.com
> brandon-+k24AcDEvnDQT0dZR+AlfA@xxxxxxxxxxxxxxxx
> 651-204-6424
> AIM: bcarl314pi
> Yahoo: bcarl314
>
>
>
> NOTE: This E-mail is confidential and its contents and any attachments
> are private and are intended only for the use of the addressee(s), and
> may contain privileged and/or confidential information. If you are not
> the intended recipient, you are hereby notified that the use,
> dissemination, distribution, or copying of this E-mail and/or the
> attachments is strictly prohibited. If there are any non-disclosure
> agreements, non-compete, or similar agreements, this message serves as
> notice that this email, its contents and attachments are confidential
> and privileged and are subject to applicable non-disclosure and
> non-compete agreements.
>
>
|
|