Normal Topic Good programming advice from IBM (Read 781 times)
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Good programming advice from IBM
May 30th, 2007 at 7:49pm
Print Post Print Post  
It appears to be about programming on Linux and also about programming a simple video game, but the advice applies to any platform or language - including SBasic (especially on 2.0).


http://www.ibm.com/developerworks/linux/library/l-clear-code/?ca=dgr-FClnxw01lin...

Note the quote from Donald Knuth - one of my favorite really smart people.

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Good programming advice from IBM
Reply #1 - May 31st, 2007 at 7:23pm
Print Post Print Post  
Mark,

Great Info Thanks.

Any plans for a Profiler for Sbasic?
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Good programming advice from IBM
Reply #2 - Jun 1st, 2007 at 1:01pm
Print Post Print Post  
BOBSCOTT wrote on May 31st, 2007 at 7:23pm:
Mark,

Great Info Thanks.

Any plans for a Profiler for Sbasic?


That is actually more in Andreas' ballpark more than mine. I don't think it has come up before. I know that he does have a simple debugger for it that he used while writing the compiler.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Good programming advice from IBM
Reply #3 - Jun 1st, 2007 at 1:26pm
Print Post Print Post  
Bob,  What is Profiler for S-Basic.  I know S Basic is the Sesame Basic but you lost me on the Profiler part.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Good programming advice from IBM
Reply #4 - Jun 1st, 2007 at 1:56pm
Print Post Print Post  
Bharat_Naik wrote on Jun 1st, 2007 at 1:26pm:
Bob,  What is Profiler for S-Basic.  I know S Basic is the Sesame Basic but you lost me on the Profiler part.




Bharat,

A profiler is a program that watches your program and figures out how much time it spends using different calls.

It is talked about in tip 5 of the link Mark posted above. I make many of the mistakes discussed in the article so it was really valuable reading to me. I was especially intrigued  by the profiler! Here is a paste from the post.

Tip 5: "Premature optimization is the root of all evil." - Donald Knuth
I didn't make up the above sentence. But you can find it on Wikipedia, so it must be really smart.
Unless you are trying to make people suffer, your first goal, when writing code, should be clarity. Simple code is faster to write, faster to understand when you return to it later, and faster to debug.
Optimization is the enemy of clarity. Sometimes, though, you have to optimize. This is especially true in games. However, and this is the vital point, you almost never know what you need to optimize until you actually take your functioning code and test it with a profiler. (A profiler is a program that watches your program and figures out how much time it spends using different calls. These are awesome programs. Find one.)
Every time I've optimized one of my games, I've invariably been blown away. The code I was most worried about was always fine. The code I'd never thought about was slow. Because I had no idea what was fast and what was slow, all optimization time I had spent before getting actual data was wasted. Worse than wasted, in fact, because it tangled up the code.
This is a hard rule to follow. Heck, if it were easy, it wouldn't have to be a rule. Good programmers tend to be offended by clumsy code that could be faster.
But rejoice! After preaching about how you should spend more time doing this and more time doing that, this is one rare, precious moment when I'm saying that it's okay to be lazy!
Write something that is clean and works. You have all the time in the world to ugly it up with optimization later. But don't do it until you're sure that you're doing the right thing.

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Good programming advice from IBM
Reply #5 - Jun 1st, 2007 at 2:07pm
Print Post Print Post  
Thanks Bob, got it now.
  
Back to top
 
IP Logged