User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Software Development category of DaniWeb, a massive community of 374,042 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,905 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Software Development advertiser:
Feb 24th, 2007, 11:36 pm
The internet gives us a wealth of information, and programming is no exception. You can literally find learn about any language just through a broadband internet connection. And since 90% of the tutorials out there are free, what better way to learn programming than if it doesn't cost us a penny? Unfortunately, many programming newbies do not realize the hidden gotchas behind using these tutorials. Too many simply do not teach us what we should not be doing, or worse yet, not teaching us what we should be doing.

Let me give some C/C++ examples, since that is the language I write software in. Look through the majority of the "starting C/C++" tutorials out there. How many actually teach you that:
  • void main is wrong
  • fflush(stdin) is undefined behaviour
  • gets is unbuffered
  • scanf() and cin >> leave trailing newlines in the input buffer
And the list goes on. Now, some of you may be thinking, "why the heck does a newbie need to know that?" Well, so that when they do encounter bad code that teaches horrid practices, they know not to use it. There are also tons of articles out there that outline the problems mentioned above, but how likely is it that a newbie is going to read that?

Perhaps a better method would be to teach safest methods, even though a bit more complicated, and then introduce other practices once the user knows how to handle them. Like teaching usage of fgets() and getline() instead of cin >> and scanf(). It's harder, yes. But the typical problem is this: a user learns the easy method by using one of the aforementioned techniques that leaves a newline in the input buffer. That's all fine until they realize that they need to input a string that has a space in it.

A smart newbie might quickly Google it, see that getline() reads an entire line, inserts it into his/her program, and then wonder why it doesn't work. That's when the friendly folk at DaniWeb has to help them out.

This problem isn't isolated in online tutorials. There are horrible university teachers that teach us crap too, and there are books that use incorrect practices. Heck, even Microsoft's MSDN uses void main in all their console examples!

Regardless, it would be nice to see fresh new "Starting C/C++" tutorials that explain techniques that can be used in the future too, not simple makeshift code that will break the minute you try to use it in a real-life application. Sure, it may not be popular among newbies, but I say "no pain, no gain". Programming isn't going to be easy, so you might as well get used to it.
This blog entry was written by John Altenmueller, staff writer aka John A. It has received 1,095 views, 0 comments, and 0 linkbacks. 1 voter has rated this entry 5 out of 5 stars.
AddThis Social Bookmark Button

Post Comment

Only community members can start a blog or comment on blog entries. You must register or log in to contribute.

DaniWeb Software Development Marketplace

Related Blog Entries
Related Forum Threads
All times are GMT -4. The time now is 12:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC