Go to Post By the way why do all american's spell Colour wrong?!?!?!?!?!?!?!? - akoscielski3 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
View Poll Results: Hmm... to be lazy or not to be lazy
Yes, just get the job done! 5 15.63%
Get the job done as quickly as possible while still being readable... 7 21.88%
No, always make sure it is structured and readable no matter how small the project! 14 43.75%
I don't care... whatever works for you. 6 18.75%
Voters: 32. You may not vote on this poll

Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-12-2003, 00:27
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Is laziness a good thing?

Ok, lets see what people think about this one...

Quote:
Originally Posted by randomperson
Remember... programming is about laziness! The only thing that really matters in the long run is whether the program actually does what its supposed to do...
Also.. lets put this limitation on it as well..

Quote:
Originally Posted by randomperson
Now wait... programs with hundreds of thousands of lines of code... thats quite different. You HAVE to have some organization otherwise that would be completely unmanageable. I'm deinfitely not talking about something like that... if the linux kernel had no structure to it then linux users would be in trouble...

However, for your own project that needs to get done, as long as it works that IS what matters. After it works, then you make it look pretty.

As for software engineering... obviously when you make code for your employer, your job depends on it being consistant with the companies coding standards and has to work with other peoples projects... but for small personal projects it isn't as necessary (unless you're perfectionist).

Theres a reason why programming traditionally has been called "hacking"...
Hacking in the sense of "putting it together quickly".

Now please note I am not advocating sloppy coding practices and not commenting... as a person who programs mostly in assembler I know the value of comments! Writing without a purpose is pointless! Writing without comments is especially useless! As far as coding practices go, everyone should have some kind of coding style they adhere to and stick to it.. otherwise you're going to get confused when you look back on it... and obviously if the project calls for something else, then use that style...

Sure... you could probably phrase "laziness" better, but im lazy....
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net

Last edited by randomperson : 16-12-2003 at 00:46.
  #2   Spotlight this post!  
Unread 16-12-2003, 00:33
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Re: Benefits of Laziness... and other stuff

No. Actually read some of the posts in http://www.chiefdelphi.com/forums/sh...ad.php?t=23052, and realize that a good chunk of them are coming from people who have degrees in computer science/software engineering and/or who work every day as programmers in industry. Feel free to disagree w/ me all you want as I'm just a lowly freshman CS major, but to argue with people like Dave Flowerday is arrogant and egotistical. One thread has already been poluted by this pointless debate, do we really need another?
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 16-12-2003, 00:42
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Re: Benefits of Laziness... and other stuff

I will disagree...

Yes, perhaps its arrogant and egotistical to argue with people who have doing this for longer than perhaps I've been alive.... however, discussion is a good thing. On the team I'm on, everyone is allowed to question anyone else for the benefit of learning. Obviously if they're wrong (and persist in it) then the other person can be put to silence very quickly. Either way everyone learns. Besides, having everyone's opinion concentrated in one area could help people struggling with the problem of being sloppy or whatever. Its better to have the pointlessness concentrated in one thread. Besides.. thats why I made it a poll
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net
  #4   Spotlight this post!  
Unread 16-12-2003, 01:15
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: Benefits of Laziness... and other stuff

(now my posting is just going to make things confusing with names...)

If you want to program haphazardly for your own projects, thats your own choice. Personally I think it is a bad habit (One that I am trying to break myself (as I throw stones inside my glass house)), but to each his own.

That being said, personally I feel that following good design principles is easier when working in a group. That is most likely due to the fact the when on a team, you need do at least some basic design to get everyone headed in the same direction. And for me, once I am doing that on paper, it is only a minor step more to get the design completed.

However, when working alone I have a tendency to hash out the design in my head (with maybe a little paper). Because of this I tend to end up in a Build & Fix mode, a fault which I am trying to fix (See aforementioned bad habit).
  #5   Spotlight this post!  
Unread 16-12-2003, 10:56
ChrisH's Avatar Unsung FIRST Hero
ChrisH ChrisH is offline
Generally Useless
FRC #0330 (Beach 'Bots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 1,230
ChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond repute
Re: Benefits of Laziness... and other stuff

I think there's a difference between sloppiness or sloth and "creative laziness". Sloppiness and sloth lead to all sorts of evil like undocumented code and the indiscriminant use of GOTO. Creative laziness is really applying the mind to make the task easier to accomplish and ultimately results in less effort expended. In general this is a good thing.

Here's a historical example:

Around the turn of the last century, there was a young man who wanted to go to college and become educated. However due to family circumstances, at the last minute he could not go and wound up getting a job as a hod carrier. That is, he spent his day carrying bricks and mortar to brick layers who were building buildings etc. Being an intelligent guy, he pretty soon started making suggestions to his supervisor on how to make his job and the job of the bricklayers easier. The supervisor told him to shut up and STOP BEING LAZY. So he went back and kept thinking of other ways to do the job easier while carrying all that stuff around. He also kept pestering the supervisor.

Finally the supervisor called his bluff. He was told that he had one day to prove his ideas and if they didn't work he would shut up or be fired. Then he was given the slowest bricklayer on the job for his test. After some instruction and I think a trip to the hardware store for some minor items, our hero was ready for the test. That day the slowest bricklayer on the job laid more bricks than the fastest guy by a significant margin, like 30%. The supervisor shut up and let our hero do things his way.

Eventually the young man stared his own company and trained his own bricklayers. It is reputed that he never lost a bid. He could afford to under bid everybody because his workforce could lay 30% more bricks in a day than his competitors. Later he sold the construction firm because he was he was more interested in making life easier for people than in putting up buildings.

So he went into the consulting business and became an "efficiency expert". His name was Frank Gilbreth, and he was one of the founders of what we now call Industrial Engineering.

Mr Gilbreth did nothing to change the way the buildings were designed or constructed. His bricklayers laid straight, even courses just like the other bricklayers of the day. They did not get their increased productivity through sloppiness. In fact, because of his radical methods he was more closely scrutinized than he would have been otherwise. The only place he changed things was in how the bricks and mortar made their way from the delivery pile to their place in the building. He reduced that labor drastically and made it so that bricklayers could spent their time laying down mortar and brick and not picking up bricks and moving them into place.

Now that's what I call laziness.....a supreme effort to not do work that is unnecessary or counterproductive. But because it often requires time observing and thinking, not doing, this effort looks an awful lot like sloth to the uninformed.

I could give other examples, but this post is long enough.
__________________
Christopher H Husmann, PE

"Who is John Galt?"
  #6   Spotlight this post!  
Unread 16-12-2003, 14:41
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Benefits of Laziness... and other stuff

I guess in one sense of the word you could say Im a lazy person:

1. I dont like to debug my work
2. I dont like to think harder than necessary
3. I dont like things to be complex if they can be simple
4. I dont like to do things over
5. I dont like to have to figure out what I was thinking (esencatailly having to re-invent it)
6. I dont like to throw away something and start over from scratch

these are all good reasons to use a diciplined structured approach to your work. When I was taking computer science classes in college, I had one project where I got the assignment, went to the computer lab, sat at a terminal and started writing code.

It was a nightmare - it took me so long to get that code right, to debug it, to even understand what I had written to be able to document it - I had learned my lesson

the next semister I got a big CS project, I went home, worked out the flow of the algorythm, worked out data structures that would make the algorythm clean, wrote out the code on paper (didnt have my own PC back then) - went to the computer lab, typed my code in, fixed a few typos

compiled it. It ran. Got the test vectors from the professors account, ran them through the program. hand checked the answers, they were correct. Turn the assignment in.

About two weeks later when the professor was handing back the graded assignments, she didnt give me mine. She glared at me and said "I want to SEE YOU in my office after class".

Hmmmmmmmm?!

In her office she told me "I want to know who you bought your program from?"

Huh?!

"I want to know where you got the assignment you handed in!"

what do you mean? I wrote it myself!

She then pulled out a computer listing and said" this is the amount of time each student has spend on a terminal since I gave that assignment out. The class average was 40 hours, some have spent 80 hours and still arnt done yet, the second lowest was 9 hours

and you spent 4 hours on the terminal! There is NO WAY you could have written that code in 4 hours.

So I had to explain to her what I said above, how I did the program flowchart... wrote it out by hand...

I pulled out all my notes, the flow chart, the hand written code (always keep an excellent notebook - It has saved my behind many times :c)

she looked at all this and said:

Oh!........ well,........OK then

you got an A+ on the project

you can go now

(She seemed a little dissapointed that she would not be able to use her harpoon today).

The point is, doing it right, doing it in a clear well thought out manner IS the easy way.

This is why companies have all these guidelines and policies - they have spent millions of $$$ in the past, learning the hard way.

But now that this has all been explained to you, you dont have to learn the hard way too :^)
  #7   Spotlight this post!  
Unread 16-12-2003, 18:03
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: Benefits of Laziness... and other stuff

Okay, the last post in the other thread I was somewhat rushed, so I'll repeat it here in detail. Anyway, programming isn't just about laziness: that's only 1/3 right. According to Randal Schwartz in the Camel (about perl, for those not familar with it), the three virtues of a programmer are Laziness, Impatience and Hubris, in that order. What! Say you? Well, let's take a look at what is meant by these words, before a heated battle ensues ... you'll find that these tend to reinforce the whole idea of structured, encapsulated, reusable programming ...

Quote:
LAZINESS: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer.

IMPATIENCE: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least that pretend to. Hence, the second great virtue of a programmer.

HUBRIS: Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer.
  #8   Spotlight this post!  
Unread 16-12-2003, 19:55
Duke 13370's Avatar
Duke 13370 Duke 13370 is offline
C is for cookie...
#0862 (Team Lightning)
Team Role: Webmaster
 
Join Date: Jan 2003
Location: Plymouth, MI
Posts: 215
Duke 13370 will become famous soon enough
Send a message via AIM to Duke 13370
Re: Benefits of Laziness... and other stuff

Whatever gets it done works fine, most the time.

comments are the devil.

Oops, typo, i meant to say "you should always make your code readable and well commented to promote good programming practices". Man, those keys are just too close together.
__________________
---Lightning Robotics!---

Last edited by Duke 13370 : 16-12-2003 at 20:00.
  #9   Spotlight this post!  
Unread 16-12-2003, 20:18
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Re: Benefits of Laziness... and other stuff

Quote:
Originally Posted by mtrawls
According to Randal Schwartz in the Camel (about perl, for those not familar with it), the three virtues of a programmer are Laziness, Impatience and Hubris, in that order.
See.. this is what I was originally talking about... I just was too lazy to look it up and write what I meant.. lol. Oh well...
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net
  #10   Spotlight this post!  
Unread 17-12-2003, 11:44
ChrisH's Avatar Unsung FIRST Hero
ChrisH ChrisH is offline
Generally Useless
FRC #0330 (Beach 'Bots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 1,230
ChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond reputeChrisH has a reputation beyond repute
Re: Benefits of Laziness... and other stuff

Quote:
Originally Posted by KenWittlief
The point is, doing it right, doing it in a clear well thought out manner IS the easy way.

This is why companies have all these guidelines and policies - they have spent millions of $$$ in the past, learning the hard way.

But now that this has all been explained to you, you dont have to learn the hard way too :^)

Looking at the other posts on this thread, I think we have come to some agreement. Namely that laziness, if carried out in a disciplined manner, is a good thing. If it is not carried out in such a manner, the result is frustration and gnashing of teeth.

I think it boils down to thinking about what you are going to do. Define the task, what goal are you trying to accomplish? Then figure out how you are going to accomplish it, and what resources you need to do so. The think some more and see if you can take anything out. When you can't see how you can do any less, then and only then are you ready to start doing something. This IS engineering.

By the way I was a little inaccurate in my recollections of Mr Gilbreth's work yesterday. He didn't improve the productivity of bricklaying by 30%, it was more like 300%. Before he came along the fastest bricklayer could lay 120 bricks per hour. The record using his methods was 450. He had a very precise process and used special scaffolds to keep the bricklayer at the proper working height in relation to the building, there are at least 10 versions of that scaffold on the market today.
__________________
Christopher H Husmann, PE

"Who is John Galt?"
  #11   Spotlight this post!  
Unread 18-12-2003, 18:16
josh_johnson josh_johnson is offline
Registered User
#1020 (Indiana Prankmonkeys)
 
Join Date: Nov 2002
Location: Muncie, IN
Posts: 58
josh_johnson is an unknown quantity at this point
Send a message via AIM to josh_johnson Send a message via Yahoo to josh_johnson
Re: Benefits of Laziness... and other stuff

Laziness does not always mean unstructured and unreadable programs that are hard to modify. When I write programs I am lazy and do what requires the least amount of work overall.

Last semester in my Computer Science class we had five projects to do over the course of the semester. These involved keeping a database of movies and the showtimes of these movies. The first would just read in from a file, storing them in an array, and writing them back out when the program was told to. The next 3 programs involved a different way of storing the movies (linked lists, simulated linked lists, and binary trees), with a little more added functionality (e.g. add, delete, search, save back to file, etc.). The final project was to put a GUI on this program.

I took the lazy way of writing this by designing my program so that I could just swap out the storage code with any of them and it would function the same. It was a little more work for the first project, but for the following projects, I just rewrote the storage mechanism with the same public API, and added a couple of functions for the additional features in the assignment. By doing this, it only took me a couple of hours to write a new storage class, and a quick addition of some functions for the additional functionality while others in the class who did not structure the program and mix the storage code with the logic code had to nearly completely rewrite their program.

By writing a well structured program, I was able to maintain and debug the code with much less work, thereby taking the lazy way out.
__________________
5! * (4! - 3! - 1!) / 2!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi