Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Programming Tip of the Day
Index -> General Programming
Goto page Previous  1, 2, 3, ... 11, 12, 13  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Naveg




PostPosted: Wed Dec 21, 2005 7:57 pm   Post subject: (No subject)

He's so modest this one ^^ Smile
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Wed Dec 21, 2005 7:58 pm   Post subject: (No subject)

Naveg wrote:
He's so modest this one ^^ Smile


Thanks.
wtd




PostPosted: Wed Dec 21, 2005 8:56 pm   Post subject: (No subject)

All large, complex problems are composed of smaller, simpler problems. It is reasonable to assume that any language or tool which makes the simple problems easier in a general manner will do the same for more complex problems.
bugzpodder




PostPosted: Wed Dec 21, 2005 10:34 pm   Post subject: (No subject)

wtd wrote:
Indent. Using spaces, not tab.

why?
wtd




PostPosted: Wed Dec 21, 2005 10:36 pm   Post subject: (No subject)

bugzpodder wrote:
wtd wrote:
Indent. Using spaces, not tab.

why?


Tabs aren't interpreted consistently across different machines. A tab might look good to you, if you have it set to display as 4 spaces, but then if it's 8 spaces in another text editor it'll look like crap.

Some text editors will convert tabs to spaces when you save the file, which is a decent compromise.
Martin




PostPosted: Wed Dec 21, 2005 11:07 pm   Post subject: (No subject)

bugzpodder wrote:
wtd wrote:
Indent. Using spaces, not tab.

why?


Alignment.

Tabs will be a variable amount of whitespace, spaces are always one space.

for example, if you have a bunch of variables documented like this:
code:

...
int userName = 5;             //the user's name
int transactionIdNo = 7;      //the ID number for the last transaction
int thisisadummyvariable = 3; //this variable didn't do very well in school


With tabs, if the tabspacing is set up differently, the comments won't necissarily be aligned. With spaces, it'll always look the same.
wtd




PostPosted: Mon Dec 26, 2005 3:31 pm   Post subject: (No subject)

Revisit your code.

Remember that little RPG you wrote with the sprites ripped off from Zelda? You thought it was pretty cool. Now, go back and look at it critically. Try to figure out ways to improve the code.

Place your code on a pedestal and you will never learn to accept constructive criticism. Not accepting constructive critism means that in five years time you'll be writing little RPGs in Turing with sprites ripped off from Zelda.
wtd




PostPosted: Thu Dec 29, 2005 2:12 am   Post subject: (No subject)

No matter how slow our program is, if it does the right thing, it will be faster than even the most heavily optimized program that does the wrong thing.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Thu Dec 29, 2005 2:31 am   Post subject: (No subject)

If your teacher won't teach you the things you should know, then learn them on your own.

For instance, I've yet to meet a CS teacher covering Java who talked about creating and using packages early in a course, and yet code re-use (and thus packages) are at the very heart of the Java programming language.
wtd




PostPosted: Thu Dec 29, 2005 2:01 pm   Post subject: (No subject)

"Do it right, or don't do it at all."

This is not a call for novices to give up. It's a challenge. Don't give up... work harder.
Martin




PostPosted: Thu Dec 29, 2005 4:48 pm   Post subject: (No subject)

wtd wrote:
"Do it right, or don't do it at all."

This is not a call for novices to give up. It's a challenge. Don't give up... work harder.

Nah. Do it. Then do it right.
wtd




PostPosted: Thu Dec 29, 2005 5:16 pm   Post subject: (No subject)

Well, doing it right refers to more than just the actual code you write. It also refers to how you go about learning something.
Naveg




PostPosted: Thu Dec 29, 2005 5:25 pm   Post subject: (No subject)

wtd wrote:
"Do it right, or don't do it at all."

This is not a call for novices to give up. It's a challenge. Don't give up... work harder.


Depends what you mean by "do it right". For example, certain teachers follow your other tip about revisiting code by having students go about an assignment a certain way, then tackling the same problem in a new, better way later on. Even though the new way is the "right way", the first step is important in the learning process.
wtd




PostPosted: Thu Dec 29, 2005 5:29 pm   Post subject: (No subject)

There can be degrees of "right". Smile

Something can be right, and still leave room for improvement. Then there are the ways that are completely wrong.

For instance, you might start out with a simple Swing app in Java that's perfectly ok design-wise, and then you're shown how to create a great degree of separation of important bits of code.

On the other hand, you might have someone write the same app with lots of static variables and almost no use of methods to factor out redundant code.
Naveg




PostPosted: Thu Dec 29, 2005 5:54 pm   Post subject: (No subject)

I agree. The only problem is where you define the different degrees of "right". Many people would argue that the only right way to make an address book program, for example, would be to use "people" objects and create an array of "people". However, many teachers use such a problem to teach arrays in the first place, using multiple arrays with corresponding indeces. While anyone with any experience with objects would clearly regard this as the wrong approach, it isn't seen that way from the point of view of the student who has just learned what an array is.

The most important step, in this case, is the realization on the part of the student, when he or she finally does learn about objects, that objects are now the "right" way.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 13  [ 184 Posts ]
Goto page Previous  1, 2, 3, ... 11, 12, 13  Next
Jump to:   


Style:  
Search: