Computer Science Canada

Programming Tip of the Day

Author:  wtd [ Tue Nov 01, 2005 1:07 pm ]
Post subject:  Programming Tip of the Day

Develop a large vocabulary. The programming manuals and other instructional material you'll read here and elsewhere are often written by people with a solid grasp of the english language and its vast vocabulary. If you do not also have a solid vocabulary, you will not be able to completely understand them, and misunderstandings in english often translate to misunderstanding of programming languages.

Author:  jamonathin [ Tue Nov 01, 2005 1:16 pm ]
Post subject: 

Very interesting. . . very true.

Since this is a tip of the day, are we going to be seeing a tip every day? Smile

Author:  wtd [ Tue Nov 01, 2005 1:21 pm ]
Post subject: 

Not necessarily. Wink

Author:  Mr. T [ Tue Nov 01, 2005 7:30 pm ]
Post subject:  Alex's Opinion

So let's call it.. "The tip of the whenever-the-hell-wtd-feels-like-writing-one." Head Bang

Author:  wtd [ Tue Nov 01, 2005 7:32 pm ]
Post subject: 

That works.

Author:  Martin [ Tue Nov 01, 2005 7:43 pm ]
Post subject: 

So wtd, why should one use accessor methods in their classes instead of public variables? It seems like a lot of extra code just to get the value of a variable. Wink Wink

Author:  wtd [ Tue Nov 01, 2005 7:45 pm ]
Post subject: 

Because accessors can be selective? You can only define a getter, and not a setter, to prevent undesired manipulation of instance variables.

Author:  Martin [ Tue Nov 01, 2005 8:05 pm ]
Post subject: 

It's also so that you could have more control over what happens when variables are accessed, and so that you can put contstraints on your variables.

Like
code:
void setSpeed (int speed) {
    if (speed < 0) {
        this.speed = 0;
    } else {
        this.speed = speed;
    }
    drawOdo();
}

Author:  wtd [ Sat Nov 12, 2005 8:25 pm ]
Post subject: 

Update:

Indent. Using spaces, not tab.

Well-formatted code is easier to figure out. The easier code is to figure out, the more likely people will be to help you.

Unless you don't want people to help you, in which case please use no indentation.

Author:  wtd [ Tue Dec 20, 2005 5:17 pm ]
Post subject: 

Just because you can do something in a given programming language, that doesn't mean you should do it.

But just because you shouldn't do something, doesn't mean you shouldn't know how to.

Author:  [Gandalf] [ Tue Dec 20, 2005 8:33 pm ]
Post subject: 

wtd wrote:
Just because you can do something in a given programming language, that doesn't mean you should do it.

But just because you shouldn't do something, doesn't mean you shouldn't know how to.

goto Razz

Author:  Tony [ Wed Dec 21, 2005 9:24 am ]
Post subject: 

[Gandalf] wrote:
goto Razz

Cornflake wrote:

while(user.status == "dumbass")
slap(user);

Author:  Martin [ Wed Dec 21, 2005 10:09 am ]
Post subject: 

Martin's tip of the day. Japanese people - don't make functions with titles in misspelled English. Recievable isn't a word.

Author:  wtd [ Wed Dec 21, 2005 6:43 pm ]
Post subject: 

Surprises in a programming languages aren't always bad. Bad surprises are, but it's not because they're surprises. It's because they're bad.

Author:  wtd [ Wed Dec 21, 2005 7:51 pm ]
Post subject: 

Some programmers can do awesome things with crappy tools. We can admire their accomplishments, but in seeking to emulate their ingenuity, we need not start from the same lowly base.

Author:  Naveg [ Wed Dec 21, 2005 7:57 pm ]
Post subject: 

He's so modest this one ^^ Smile

Author:  wtd [ Wed Dec 21, 2005 7:58 pm ]
Post subject: 

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


Thanks.

Author:  wtd [ Wed Dec 21, 2005 8:56 pm ]
Post 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.

Author:  bugzpodder [ Wed Dec 21, 2005 10:34 pm ]
Post subject: 

wtd wrote:
Indent. Using spaces, not tab.

why?

Author:  wtd [ Wed Dec 21, 2005 10:36 pm ]
Post 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.

Author:  Martin [ Wed Dec 21, 2005 11:07 pm ]
Post 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.

Author:  wtd [ Mon Dec 26, 2005 3:31 pm ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 2:12 am ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 2:31 am ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 2:01 pm ]
Post 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.

Author:  Martin [ Thu Dec 29, 2005 4:48 pm ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 5:16 pm ]
Post 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.

Author:  Naveg [ Thu Dec 29, 2005 5:25 pm ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 5:29 pm ]
Post 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.

Author:  Naveg [ Thu Dec 29, 2005 5:54 pm ]
Post 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.

Author:  wtd [ Thu Dec 29, 2005 6:00 pm ]
Post subject: 

Well, this is an area that's really troublesome. You have to match the assignment to the concept without getting too far ahead. Teachers shouldn't be giving students problems which call for aggregate data structures (records, objects) when students have not yet been given any idea how to deal with that.

The thing to keep in mind, I think is that once you teach something, it's very difficult to unteach it. Once someone learsn to handle aggregate data management with parallel arrays, they'll fall back to that even when shown how to use aggregate data structures in a single array.

Author:  wtd [ Wed Jan 04, 2006 8:01 pm ]
Post subject: 

Converting a fanatic is not the same as opening a mind.

You got your friend to switch from Windows to Linux, or frm using Java to using Ruby. Congratulations, but if he or she brings slavish, unquestioning, fanatical devotion to that new technology, then you have not done anyone a favor.

Author:  Martin [ Wed Jan 04, 2006 8:19 pm ]
Post subject: 

wtd wrote:
Converting a fanatic is not the same as opening a mind.

You got your friend to switch from Windows to Linux, or frm using Java to using Ruby. Congratulations, but if he or she brings slavish, unquestioning, fanatical devotion to that new technology, then you have not done anyone a favor.


cough95percentofapplesuserbasecough

Author:  wtd [ Wed Jan 04, 2006 8:23 pm ]
Post subject: 

I was actually thinking of those solidly entrenched in the AMD vs. Intel flamewars.

Author:  Martin [ Wed Jan 04, 2006 8:43 pm ]
Post subject: 

Those people too. But Mac people now also fall into that category. As much as I like my iMac, I hate that it means I now belong to a closer demographic to these crazy Mac people.

Author:  wtd [ Wed Jan 04, 2006 8:48 pm ]
Post subject: 

I think the problem is that the ones you see are the zealots. You don't see the legions of folks using Macs professionally. Go to a Java conference hosted by Sun or OSCON and look at the sea of iBooks and Powerbooks that have replaced the sea of Thinkpads. Are these people raving fanatics with undying loyalty to Apple?

Author:  Martin [ Wed Jan 04, 2006 8:51 pm ]
Post subject: 

True that.

Author:  Geminias [ Thu Jan 05, 2006 7:15 am ]
Post subject: 

i dont use a mac, but i'd say its safe to say where these mac people are coming from. Mac computers have always been better, performance wise, than any pc. Which is why people who understand this grit their teeth at how ignored Mac is in the software department...

i read an article that the mac x2 or x3 (i forget) has a bus speed of 1.1ghz.

I suppose pc could do that too... but at the consumers cost. I believe current bus speeds (pretty much the most important thing to look at now that processers have topped 1.5ghz) for a pc are 400mhz for top of the line motherboards. sigh.

Author:  md [ Thu Jan 05, 2006 9:26 am ]
Post subject: 

Geminias wrote:
i dont use a mac, but i'd say its safe to say where these mac people are coming from. Mac computers have always been better, performance wise, than any pc. Which is why people who understand this grit their teeth at how ignored Mac is in the software department...

i read an article that the mac x2 or x3 (i forget) has a bus speed of 1.1ghz.

I suppose pc could do that too... but at the consumers cost. I believe current bus speeds (pretty much the most important thing to look at now that processers have topped 1.5ghz) for a pc are 400mhz for top of the line motherboards. sigh.

Performance on Macs is not always better. Macs do have very good performance but it is definitely possible to build a better performing PC, though it might cost a bit more then the mac.

As for bus speeds, the current top bus speen for PCs is 1066 MHz, and the most common bus speed after that is 600 MHz. But that only applies to intel chips as AMD uses an entirely different way of doing things that is very similar to the way PowerPC chips do things.

Be sure of what your saying next time, otherwise you just look dumb.

Author:  Geminias [ Thu Jan 05, 2006 10:30 am ]
Post subject: 

umm bus speeds as in the ram module sending data to the cpu. its at 400mhz, commonly. and you say mac is not always better than pc... well ever since macs and pc's existed at the same time mac has been ahead in every aspect 90% of the time... there were a few instances where pc manufacturers developed some higher technology faster, but then that didnt matter too much because the macs would still out perform the pc's due to the pc's being unable to properly implement it due to: bad design. which is what pc is still struggling to get itself out of today.

but of course thats just my oppinion based on the few articles i read and also my uncle who used to be a computer engineer designing mobo's for pc.

Author:  wtd [ Thu Jan 05, 2006 1:18 pm ]
Post subject: 

Yes, Apple does have the opportunity to more optimally design computers since they make the whole thing. You don't have to worry about some shady company selling computers with fast processors, but really slow hard drives or such.

But Apple is not perfect. Cosnider the G4. It was great in its day, but bus issues formed a bottleneck in the system that Apple has had a very hard time dealing with.

It's the software that makes Apple special, and the emphasis on design.

The most common bottleneck for a modern personal computer is the human sitting in front of it. If the software makes it possible to do what you want to faster and easier, then even a slower computer can seem faster.

Author:  Geminias [ Thu Jan 05, 2006 1:30 pm ]
Post subject: 

yeah definitely, definitely, but when discussing such things as hardware performance you have to assume that both are tested with equally optimum or equally crappy software. Otherwise, its no longer about hardware but software.

Author:  md [ Thu Jan 05, 2006 6:46 pm ]
Post subject: 

Geminias wrote:
umm bus speeds as in the ram module sending data to the cpu. its at 400mhz, commonly. and you say mac is not always better than pc... well ever since macs and pc's existed at the same time mac has been ahead in every aspect 90% of the time... there were a few instances where pc manufacturers developed some higher technology faster, but then that didnt matter too much because the macs would still out perform the pc's due to the pc's being unable to properly implement it due to: bad design. which is what pc is still struggling to get itself out of today.

but of course thats just my oppinion based on the few articles i read and also my uncle who used to be a computer engineer designing mobo's for pc.


I'm not trying to start a flame war... just pointing that out... but,

Bus speed is not the speed of the memory, and the memory speed on both PCs and Macs is generally the same; though PCs usually adopt new, faster standards quicker. Point, PC.

PCs also generally don't suffer from bad design. There are definitely bad designs out there, but if you're buying your own hardware you can easilly avoid the crappy stuff. That's one of the advantages of PCs, you can pick and choose your componets as opposed to relying on what one specific company says you can use.

Author:  Martin [ Thu Jan 05, 2006 8:04 pm ]
Post subject: 

AMD64's have 2GHz FSB's guys...

Power isn't really what Apple's all about though. Apple computers are quick enough, but you can get a faster PC at any Apple price point no problem. There's no argument - you can get faster, better hardware for cheaper for a PC.

What Apple's about is design in both hardware and software. You get a fairly decent software package with the mac, and OSX is for the most part nicer to use than Windows. I can't say that it's nicer than Linux though. I ditched OSX for it pretty quickly, mostly because the Finder is by far the most useless program ever invented. I'd rather use Microsoft's Hearts for file management. Want to see the path to your current directory? Hah, tough. Want to merge the contents of two folders? Good thing you know how to use Perl!

Apple's big problem I think right now is the lack of flexibility that their hardware offers. Want to upgrade your iMac? Great! It's really easy - just throw it out and buy a new one.

Author:  wtd [ Thu Jan 05, 2006 8:14 pm ]
Post subject: 

Did you try using something like Pathfinder, instead of Finder? Did you research alternatives to the Finder since you find it unpleasant?

The key to Apple's success, in a nutshell, has generally been to not ship hardware without software that can take advantage of it.

I mean, doesn't take much to get a Wintel box with a DVD burner anymore, but I still see people using Windows going nuts trying to find software that can make that piece of hardware useful.

Author:  wtd [ Thu Jan 05, 2006 8:29 pm ]
Post subject: 

Breaking from the Apple dscussion...

Ponder this statement for a bit: "Sure FP offers a way to solve the problem, but requires more education than more complex systems."

FP = Functional Programming

Does this kind of justification for "mainstream" OO languages even begin to make sense?

Author:  Martin [ Thu Jan 05, 2006 8:34 pm ]
Post subject: 

wtd wrote:
Did you try using something like Pathfinder, instead of Finder? Did you research alternatives to the Finder since you find it unpleasant?


I installed Linux Wink Now if only I could get my remote to work with it...

I do boot OSX sometimes, mostly to play UT2004. Kind of like my Windows usage of times long past...

I'll check out pathfinder when I get home.

Author:  rizzix [ Thu Jan 05, 2006 9:37 pm ]
Post subject: 

Linux is my hobby OS. No way can it replace OSX. Quality of apps avaible of OSX out beat those for Linux anyday. Gee.

Author:  rizzix [ Thu Jan 05, 2006 9:41 pm ]
Post subject: 

wtd wrote:
Breaking from the Apple dscussion...

Ponder this statement for a bit: "Sure FP offers a way to solve the problem, but requires more education than more complex systems."

FP = Functional Programming

Does this kind of justification for "mainstream" OO languages even begin to make sense?


No but I can give you another reason to avoid FP: It's much more difficult to debug code. If not your own code, then somebody else's. On the other hand most of these mainstream OO languages make debugging code super easy.

Yet its a hard choice. Consider..

FP: Most common bugs found in mainstream OO languages do not apply here. Some complex algorithms are better written in FP than in imperative languages. But debugging code could be difficult. Efficiency is also an issue at times.

Mainstream: Bugs are very easily introduced. But debugging is extremely simple (with an exception to some ugly languages, e.g. C++).

Author:  wtd [ Thu Jan 05, 2006 10:19 pm ]
Post subject: 

I just find it very odd to say that more complex systems require less education. Methinks this thinking gave us the BSOD.

Author:  rizzix [ Thu Jan 05, 2006 10:23 pm ]
Post subject: 

I think C and C++ should be banned! Safer alternatives should be used instead, as in Cyclone and D

Author:  Martin [ Thu Jan 05, 2006 10:37 pm ]
Post subject: 

I don't see the quality of apps thing for OSX. iTunes is decent, but doesn't have ANY codec support. QuickTime player is slow and doesn't support full screen mode out of the box. Pages is junk to use (cheap though, I guess). OSX is great, sure, but as for software - nothing has blown me away so far.

Author:  rizzix [ Thu Jan 05, 2006 10:51 pm ]
Post subject: 

Quicktime is the only player so far to succesfully play h264 coded video without any problems. None of the opensource alternatives can match it yet (both in terms of speed and stability). Techinically yea, you need quicktime pro to utilize some feature, but it's not entirly true. Apple's quicktime framework has support for all these features out-of-the-box and you don't have to pay a dime. Just search for a quicktime "clone" and you might get one that unlocks these feature for free.

iTunes does not have a large choice in audio formats, but what it has are the best: AAC, (the commonly used MP3). Either way you can have an app bloated with features, but it's poorly designed, and hence low in "quality". Most linux/opensouce apps fall under this category. They focus too much on functionality, they leave out design and stability.

I don't know about Pages. I should give it a try and evaluate it my self. But I do use M$ Office 2004, and it's pretty darn good. Maybe not the best designed app, but good enough to be considered a mac app.

Author:  Martin [ Thu Jan 05, 2006 11:04 pm ]
Post subject: 

rizzix wrote:
Quicktime is the only player so far to succesfully play h264 coded video without any problems. None of the opensource alternatives can match it yet (both in terms of speed and stability). Techinically yea, you need quicktime pro to utilize some feature, but it's not entirly true. Apple's quicktime framework has support for all these features out-of-the-box and you don't have to pay a dime. Just search for a quicktime "clone" and you might get one that unlocks these feature for free.

Like VLC or MPlayer, which aren't Mac specific apps.

rizzix wrote:
iTunes does not have a large choice in audio formats, but what it has are the best: AAC, (the commonly used MP3). Either way you can have an app bloated with features, but it's poorly designed, and hence low in "quality". Most linux/opensouce apps fall under this category. They focus too much on functionality, they leave out design and stability.

xmms is bloated? mpg123 is bloated? I've never used a media player that uses more memory than iTunes. Or on Windows, Foobar2000 I think takes the crown.

rizzix wrote:
I don't know about Pages. I should give it a try and evaluate it my self. But I do use M$ Office 2004, and it's pretty darn good. Maybe not the best designed app, but good enough to be considered a mac app.

If the definition of Mac app is 'good software,' well then yeah...


Here's what I don't get. OSX is great, but everyone preaches that it has all of this great software for it - where? iLife is nice, but there are free alternatives that are better. Sure it comes with a lot nicer a selection of software than a Windows box, but that's beside the point.

Author:  wtd [ Thu Jan 05, 2006 11:11 pm ]
Post subject: 

Have you looked at VersionTracker?

Author:  rizzix [ Thu Jan 05, 2006 11:24 pm ]
Post subject: 

VLC and MPlayer both have failed to play h264 encoded video properly. Well i've tried and it failed.

Besides, VLC is SLOW as hell. MPlayer isin't too bad, but it's gui interface is pathetic.



OK I wasn't just talking about music player when i mentions the apps were bloated. I was talling about most opensource apps in general.


Bah about Office2004 comment, most apps following the Apple human interface design specs usually are designed pretty well. M$ has tried their best.

Author:  wtd [ Fri Jan 20, 2006 1:25 pm ]
Post subject: 

Your teachers, who have years more experience than you as a student, are ironically not there to answer your questions.

They are there to ask the questions, and it is your job to answer them. The purpose of their knowledge and experience is to make sure you ask the correct questions, and to be able to tell you if you're right or wrong.

Additionally, when you answer their questions, do not answer uncertainly. Answer with confidence. Be prepared to be wrong, of course, but have the confidence to back your answer up if challenged.

If you do not have this confidence, it likely means you have not done enough research, or you have not thoroughly experimented to determine whether your answer will stand up to testing.

Author:  wtd [ Sat Jan 21, 2006 3:40 pm ]
Post subject: 

Solve the easy problems first. Use the experience you gain and the lessons learned to make the hard problems easier.

Author:  wtd [ Sun Jan 29, 2006 5:06 pm ]
Post subject: 

The measure of code expressiveness is not purely brevity.

All other things being equal, it's a good thing, but the true measure of expressiveness is how directly the code represents your intent.

Author:  Martin [ Mon Jan 30, 2006 6:11 am ]
Post subject: 

Learn how to use bit shifting, and use it! You will save a ton of memory and increase performance too!

Author:  wtd [ Mon Jan 30, 2006 3:06 pm ]
Post subject: 

Avoid premature optimization!

Author:  Martin [ Mon Jan 30, 2006 7:15 pm ]
Post subject: 

Touché.


Learn how to use typesafe enumeration before you learn how to use bit shifting.

Author:  wtd [ Mon Jan 30, 2006 10:56 pm ]
Post subject: 

Martin wrote:
Learn how to write expressive code before you learn how to write fast code.


There, fixed that for ya. Wink

Author:  wtd [ Tue Jan 31, 2006 3:06 pm ]
Post subject: 

Different programming languages have different strengths. Sometimes these strengths are so great that it's easier to learn an entirely new language than to tackle a problem in a language you already know.

Author:  wtd [ Tue Feb 07, 2006 12:27 pm ]
Post subject: 

There is no spoon

Once we have learned a few things, gained a few skills, there is a tendency to view new ideas with suspicion. They are not like what we already know, so something must surely be wrong with them.

Instead of thinking this way, remember that when you started out with <insert language here> it was hard. There were likely moments when you muttered and said it was impossible.

There is no spoon. Everything is unnatural and awkward in the programming world. Nothing makes any real kind of sense, and ncertainly nothing is intuitive.

And you know... we manage. Remind yourself that you've already overcome obstacles you didn't think you could, and new ones will not seem so insurmountable.

Author:  bugzpodder [ Wed Feb 08, 2006 2:35 pm ]
Post subject: 

wtd wrote:
Avoid premature optimization!


Knuth

Author:  wtd [ Thu Feb 09, 2006 1:34 pm ]
Post subject: 

The biggest part of programming is semantics. Take for instance an issue from object-oriented programming.

Methods. Why you should separate code into a separate method is vastly more important than understanding how to do it.

If you're learning, pick the language and tool combination that lets you experiment the fastest.

It's the why that makes our heads hurt. It has us crying out in frustration. Get past that and the how is child's play.

Author:  wtd [ Fri Feb 10, 2006 1:37 pm ]
Post subject: 

Don't be afraid of learning things "wrong" if you try to learn without the structure of a class and a teacher.

Is there the chance you might get things wrong? Yes. But that chance exists when you have a teacher too. So, why shouldn't you fear this?

Because you can put your knowledge to the test. Especially in the world of programming. If you fear you've screwed something up, try it and see if it works.

Author:  MihaiG [ Mon Feb 13, 2006 9:49 pm ]
Post subject: 

Hes like confucious.....but for prgramming Confused
I am not worthy I am not worthy

Author:  Martin [ Mon Feb 13, 2006 10:29 pm ]
Post subject: 

Nice, El Comandante Smile

There is no fork
Well, there is, but you probably shouldn't be using it. Save the big guns for when you really need them. You can probably kill a fly with a machine gun, but a fly swatter is cheaper and you won't have to pay to replace your walls and furniture when you're done.

Author:  Martin [ Wed Feb 15, 2006 7:53 pm ]
Post subject: 

Google.

'Nuff said.

Author:  Cervantes [ Fri Mar 17, 2006 9:07 pm ]
Post subject: 

wtd wrote:

Converting a fanatic is not the same as opening a mind.


How true. And it hits upon what I feel is the main theme of this thread.

Have an open mind. Be open to new languages, new programming paradigms, new solutions to a problem. Closed minds can never advance; this prevents them from ever succeeding. Further, two closed minds with different views can never reach an agreement; this prevents anything from being achieved in a group project.

The world of programming is so large and changes so fast that there's always something to learn, even for the gurus. Learn, learn, learn. Learn new languages; learn new programming paradigms; learn new solutions to a problem. More options never hurt anybody, and often the "alternative" is better than the "preferred".

Be yourself, but at the same time heed the wisdom of others. Create your own opinion, but think critically about the advice you're given. Realize that the group following wtd learning languages like Ruby and O'Caml has thought critically about their decision, but do not blindly accept their thought as correct, for there is an opposing group elsewhere that learns only Java and C++.

Author:  chrispminis [ Sun Mar 19, 2006 7:18 pm ]
Post subject: 

You know, I REALLY think we could take this thread and some, and write up a genuinely useful book...

Author:  wtd [ Sun Jun 25, 2006 11:10 am ]
Post subject: 

Cervantes wrote:
Be yourself, but at the same time heed the wisdom of others. Create your own opinion, but think critically about the advice you're given. Realize that the group following wtd learning languages like Ruby and O'Caml has thought critically about their decision, but do not blindly accept their thought as correct, for there is an opposing group elsewhere that learns only Java and C++.


Pay special attention to the people who've learned Ruby and O'Caml and Java and C++.

Author:  wtd [ Sun Jun 25, 2006 11:13 am ]
Post subject: 

So you want to learn Java?

So why on earth would you consider understanding C important in this? It's not garbage-collected, has no object orientation support, and lacks an oh-so-important sane string type.

Well, understanding C is a bonus because Java's creator's really liked C. Someone who knows Java and understands C pointers will program in Java much more smoothly than someone who has only studied Java.

Author:  Slaivis [ Wed Jun 28, 2006 10:32 pm ]
Post subject: 

wtd wrote:
So you want to learn Java?

So why on earth would you consider understanding C important in this? It's not garbage-collected, has no object orientation support, and lacks an oh-so-important sane string type.

Well, understanding C is a bonus because Java's creator's really liked C. Someone who knows Java and understands C pointers will program in Java much more smoothly than someone who has only studied Java.


But will understanding Java help you program in C?

Author:  wtd [ Wed Jun 28, 2006 11:21 pm ]
Post subject: 

Slaivis wrote:
wtd wrote:
So you want to learn Java?

So why on earth would you consider understanding C important in this? It's not garbage-collected, has no object orientation support, and lacks an oh-so-important sane string type.

Well, understanding C is a bonus because Java's creator's really liked C. Someone who knows Java and understands C pointers will program in Java much more smoothly than someone who has only studied Java.


But will understanding Java help you program in C?


Somewhat with the syntax, perhaps, and it might motivate one to investigate things like using static linking to hide the actual composition of a struct.

Author:  wtd [ Sun Jul 23, 2006 3:56 pm ]
Post subject: 

If you don't understand the general concept of interfaces, then you don't understand OOP.

Author:  wtd [ Sun Jul 23, 2006 4:01 pm ]
Post subject: 

If you know Ruby, but have no idea what the "erb" program is for, then now is the time to learn.

Author:  Martin [ Sun Jul 23, 2006 9:37 pm ]
Post subject: 

Documentation is for suckers.

Author:  wtd [ Sun Jul 23, 2006 10:14 pm ]
Post subject: 

Perl is only unreadable gibberish if you don't know Perl. But that holds true for any language.

Author:  rizzix [ Wed Jul 26, 2006 9:53 am ]
Post subject: 

Not haskell.. Yes most languages look like gibberish, but haskell didn't. Of course I didn't understand a thing back them.. but it read like english.. to some extent.

Same is true for AppeScript. Actually AppleScript is bit easier to infer even for a complete newbie.

Author:  Slaivis [ Wed Jul 26, 2006 5:18 pm ]
Post subject: 

rizzix wrote:
Not haskell.. Yes most languages look like gibberish, but haskell didn't. Of course I didn't understand a thing back them.. but it read like english.. to some extent.

Same is true for AppeScript. Actually AppleScript is bit easier to infer even for a complete newbie.


Possibly for Turing aswell.

Author:  Clayton [ Wed Jul 26, 2006 7:23 pm ]
Post subject: 

true but readability is a very minor thing when learning a new language (at least to me), turing may be readable, but that readability doesnt make up for its major drawbacks (a decent OOP environment for example)

Author:  wtd [ Wed Aug 09, 2006 7:48 pm ]
Post subject: 

If you wish to do GUI programming, give Glade a long, thorough look.

Author:  wtd [ Sat Aug 12, 2006 12:41 pm ]
Post subject: 

Traditionally, we've thought about solving programming problems as a process of bringing our problem closer to the logic of a programming language.

But the smart money is on a different approach. Instead of just solely doing this, build the language up to meet your problem. Ever thought, "this would be so much easier if there were some easy way in the language to do X." Well, then extend the language so it can do X.

Author:  wtd [ Wed Sep 06, 2006 12:01 pm ]
Post subject: 

Data structures like linkied lists are about boolean logic, not pointers. As it happens, pointers are the only way of expressing such boolean logic with regards to types in some languages.

Pointers can express boolean logic by being either a valid pointer to something, or null.

More expressive type systems may be able to (and often do) express data structures without explicit pointers.

Do not be confused about this just because many college and university programs combine data structure classes and pointer education into a single curriculum.

Author:  wtd [ Fri Nov 10, 2006 2:09 pm ]
Post subject: 

If you really want a corporate programming job (they pay pretty well) then think about the little things you normally take for granted. Think about them a lot.

Think about walking into a giant store like Wal-Mart. You buy a box of pop-tarts.

How do they know how many pop-tarts have sold? Do they go through and count them by hand all the time?

Of course they don't! Sure, they might hand-count once in awhile if there's a big discrepancy, but that costs money, and they have a lot of stuff to count, and paying people to count stuff costs a lot of money.

No. They have a database somewhere that keeps track of how many pop tarts are in every store. When you check out, it does a:

code:
pop_tarts--;


And when it gets low enough, they order more. How do they know how many to order?

They've got somebody who keeps track and really understands how things sell, right?

Heck no!

People who understand stuff make a lot of money. Money Wal-Mart would have to pay them. Computers cost money too, but a lot less, minus an initial cost.

So the computer keeps track of how much stuff has sold, and how much is left, and it calculates how much more is needed. But, it doesn't stop there. It takes into account weather, and traffic issues, and events in the news.

For instance, rain happens to historically correspond to strong sales of strawberry pop-tarts. So the computer checks the weather forecast. It sees a high probability of rain. It orders lots more strawberry pop-tarts than necessary. A week later it checks to see if the last week has validated that decision.

The result: costs are lower, and the local Wal-Mart doesn't get swamped by excess pop-tarts, or customer complaints that they're out of strawberry pop-tarts.

But computers don't learn to do this by themselves... yet.

Computer programmers make this possible. Whether you agree with Wal-Mart's ethics or not, it's pretty amazing what those programmers made possible.

Author:  wtd [ Thu Dec 14, 2006 10:09 pm ]
Post subject: 

Textbook knowledge is no substitute for practical experience.

Practical experience is no substitute for textbook knowledge.

Author:  Craige [ Thu Dec 21, 2006 4:31 pm ]
Post subject: 

These are all very insightful. Please, do go on.

Author:  wtd [ Fri Dec 22, 2006 10:24 am ]
Post subject: 

Ask questions frequently and early, and heed the advice given. Do not fail to ask about something because you feel it's too trivial.

The real mistake is writing a lot of code, and then asking questions. If you're going in the wrong direction, and you have a lot of code, you're going to have inertia working against you. You won't want to go back and change that code. You'll want to keep doing things the way you have been.

Buddhists will tell you this:

Quote:
From attachment arises sorrow,
From attachment arises fear.
For one who is freed from attachment,
There is no sorrow -- whence fear?

Author:  wtd [ Sun Dec 24, 2006 12:29 am ]
Post subject: 

Solving problems with programming typically involves breaking down a problem until it can be expressed in terms of the programming language you've chosen. But, this can suck, especially when the language in question is not very expressive.

Consider also building the language up to meet your problem halfway. If you find yourself saying, "this would be so much easier if X did Y" quite frequently, and Y is reasonably simple or fundamental, then extend the language so that it does Y.

Author:  wtd [ Thu Jan 11, 2007 3:47 am ]
Post subject:  Re: Programming Tip of the Day

Learning to be a programmer is a great experience. It teaches you about abstract thinking, and problem-solving. The multitude of programming languages and approaches to problem-solving can really open your mind.

That said, just because you're learning to be a programmer, doesn't mean you have to actually be one when you get a piece of fancy paper.

Be a well-rounded individual both intellectually and socially. Programming can hone your mind, but once that has happened, you don't have to apply it back to programming. You don't owe some inaminate lump of silicon and steel a damn thing.

Author:  wtd [ Mon Jan 22, 2007 11:12 am ]
Post subject:  Re: Programming Tip of the Day

When learning to program, you don't need a program that will debug code. You already have one. It's your brain.

Follow the flow of control and the change of state in your mind. It'll hurt. It'll probably hurt a lot.

It'll also make you a better programmer.

Author:  wtd [ Mon Jan 22, 2007 11:55 am ]
Post subject:  RE:Programming Tip of the Day

It's not that "Design Patterns" are necessarily bad...

It's just that if you use a language with powerful enough abstractions, the patterns just come so naturally that you end up taking them for granted.

Author:  jamonathin [ Mon Jan 22, 2007 12:49 pm ]
Post subject:  Re: Programming Tip of the Day

wtd the great wrote:
"Be a well-rounded individual both intellectually and socially. Programming can hone your mind, but once that has happened, you don't have to apply it back to programming. You don't owe some inaminate lump of silicon and steel a damn thing."

= my favorite quote.

Author:  ZeroPaladn [ Wed Jan 24, 2007 10:55 am ]
Post subject:  Re: Programming Tip of the Day

jamonathin wrote:

wtd > God wrote:
"Be a well-rounded individual both intellectually and socially. Programming can hone your mind, but once that has happened, you don't have to apply it back to programming. You don't owe some inaminate lump of silicon and steel a damn thing."

= my favorite quote.
Amen.

Oh, by the way, they're mostly made of aluminium now Very Happy

Author:  wtd [ Sun Mar 11, 2007 8:44 pm ]
Post subject:  Re: Programming Tip of the Day

Do not spend much time asking "is language X worth learning?"

Just restrict the set from which X is drawn to those languages which are relatively quick and easy to learn.

Author:  wtd [ Sun Mar 25, 2007 8:43 am ]
Post subject:  Re: Programming Tip of the Day

If C and C++ are such a great way to introduce students to programming, then why are there so many lousy C and C++ programmers out there?

The point: Do not believe hyperbole. Believe your eyes.

Author:  abcdefghijklmnopqrstuvwxy [ Sun Mar 25, 2007 5:30 pm ]
Post subject:  Re: Programming Tip of the Day

Quote:

If C and C++ are such a great way to introduce students to programming, then why are there so many lousy C and C++ programmers out there?


That's like someone without any sense saying to you "If basic training is the best way to start out in the military, why are there so many lousy solidiers out there?"

Analysis:
Basic training and the amount of soldiers who are lousy have no coorelation. All soldiers learned basic training, the two are not relative but absolute.
A real coorelation? The quality of the individuals recruited and the amount of lousy soldiers in the army.

Same goes for programming. While say a scripting language is far easier to learn there are many learned individuals who would contend it is these languages that tend to create the "bad habits" as they descend to lower level programming. The argument goes both ways, but it's only logical to assume understanding the fundamentals will help (actually help is an understatement) in understanding the simplifications used in higher level languages.

EDIT: someone's been deleting all my threads including my little genius-as-me quiz. I'd just like to point out how rude that is and how much I don't even feel like posting at this forum anymore.

Author:  klopyrev [ Sun Mar 25, 2007 5:50 pm ]
Post subject:  Re: Programming Tip of the Day

There are so many lousy C/C++ programmers just because there are so many C/C++ programmers.

Author:  Clayton [ Sun Mar 25, 2007 6:37 pm ]
Post subject:  RE:Programming Tip of the Day

abcdefghijklmnopqrstuvwxy wrote:
EDIT: someone's been deleting all my threads including my little genius-as-me quiz. I'd just like to point out how rude that is and how much I don't even feel like posting at this forum anymore.


No one has deleted your threads, they've just been locked. If you ever bothered to look at the Recent Discussions list, you'd see both of those threads there.

Author:  abcdefghijklmnopqrstuvwxy [ Sun Mar 25, 2007 7:12 pm ]
Post subject:  RE:Programming Tip of the Day

Oh okay, thanks Freakman, that makes me feel slightly better although I'm surprised it would get locked for that.

Author:  Brightguy [ Sun Mar 25, 2007 9:02 pm ]
Post subject:  Re: Programming Tip of the Day

'Lousy' is a pretty subjective term... and the best way of teaching such programmers even more subjective. I would guess that the methodology is more important than the actual language used. But ultimately it comes down to the individual's understanding and their willingness to learn.

On a side note, I think topics are locked too easily, there didn't seem to be a need for it...

Author:  md [ Sun Mar 25, 2007 9:32 pm ]
Post subject:  RE:Programming Tip of the Day

Tip of the day: Stop discussing things in the Tip Of The Day thread.

Author:  Cervantes [ Mon Mar 26, 2007 4:32 pm ]
Post subject:  RE:Programming Tip of the Day

md, discussion is the point of a forum. (So long as it's constructive.)

I think wtd's point is that there are a disproportionate amount of lousy C/C++ programmers out there. Whether that statistic is true or not will not be validated by me. However, think about it for yourselves.

Author:  Bobrobyn [ Mon Mar 26, 2007 7:37 pm ]
Post subject:  Re: RE:Programming Tip of the Day

Cervantes @ Mon Mar 26, 2007 5:32 pm wrote:
md, discussion is the point of a forum. (So long as it's constructive.)

I think wtd's point is that there are a disproportionate amount of lousy C/C++ programmers out there. Whether that statistic is true or not will not be validated by me. However, think about it for yourselves.


I think that part of what wtd might also mean is that people are learning C and C++ poorly instead of learning an easier to learn language well. At the very least, I agree with this statement that I just made up Razz

Author:  wtd [ Mon Mar 26, 2007 10:05 pm ]
Post subject:  Re: RE:Programming Tip of the Day

Bobrobyn @ Tue Mar 27, 2007 8:37 am wrote:
Cervantes @ Mon Mar 26, 2007 5:32 pm wrote:
md, discussion is the point of a forum. (So long as it's constructive.)

I think wtd's point is that there are a disproportionate amount of lousy C/C++ programmers out there. Whether that statistic is true or not will not be validated by me. However, think about it for yourselves.


I think that part of what wtd might also mean is that people are learning C and C++ poorly instead of learning an easier to learn language well. At the very least, I agree with this statement that I just made up Razz


This is more or less accurate. The more general point relates to people believing that these are good languages to start with just because schools often do it this way, rather than looking at the results and coming to the conclusion that it doesn't work.

Author:  abcdefghijklmnopqrstuvwxy [ Tue Mar 27, 2007 12:11 am ]
Post subject:  RE:Programming Tip of the Day

Are you right wtd? You seem to always think you're right even in matters where there is no right... You can produce good programmers by starting with C++ or any other language. The language you start learning with is NOT the key factor in the success of the programmer. Not by far. To prove this take into account how many people began with C++ and any other language and became successful in computer science. Who are you to suggest what's best for everyone, wtd? Honestly I think it's time you admit your wrong the for the first time in your life. It's not so bad being wrong wtd... But it's just plain faulty logic to compare the amount of people who start off with C++ and the amount of bad programmers there are. The only conclusion you can draw is that most people start with C++, nothing more...

Author:  rdrake [ Tue Mar 27, 2007 12:36 am ]
Post subject:  RE:Programming Tip of the Day

Even the vast pool of knowledge can be tainted. Take everything you hear with a grain of salt.

Author:  wtd [ Tue Mar 27, 2007 2:13 am ]
Post subject:  Re: RE:Programming Tip of the Day

rdrake @ Tue Mar 27, 2007 1:36 pm wrote:
Even the vast pool of knowledge can be tainted. Take everything you hear with a grain of salt.


Essentially, the point I was trying to make, much more succinctly expressed.

Author:  Cervantes [ Tue Mar 27, 2007 12:19 pm ]
Post subject:  Re: RE:Programming Tip of the Day

abcdefghijklmnopqrstuvwxy @ Tue Mar 27, 2007 12:11 am wrote:
Are you right wtd? You seem to always think you're right even in matters where there is no right... You can produce good programmers by starting with C++ or any other language. The language you start learning with is NOT the key factor in the success of the programmer. Not by far. To prove this take into account how many people began with C++ and any other language and became successful in computer science. Who are you to suggest what's best for everyone, wtd? Honestly I think it's time you admit your wrong the for the first time in your life. It's not so bad being wrong wtd... But it's just plain faulty logic to compare the amount of people who start off with C++ and the amount of bad programmers there are. The only conclusion you can draw is that most people start with C++, nothing more...


The fact of the matter is that neither of you have provided any facts on the issue. You both have your conceptions, but no facts to support it. Only your own personal experiences. This discussion is moot unless facts are presented.

And alphabet, you're acting awfully condescending. What's worse is that it's directed at wtd. If I had to pick one person on this forum who doesn't deserve that kind of attitude, it would be wtd.

Author:  wtd [ Fri Apr 06, 2007 12:04 pm ]
Post subject:  Re: Programming Tip of the Day

Life is full of surprises, and we rarely end up where we think we will. If you find your future ending up exactly as you envisioned, it means that one of two things has happened. Either you've been incredibly dedicated to your goals, or you've missed an important opportunity.

Or both.

Author:  wtd [ Wed May 30, 2007 1:54 pm ]
Post subject:  Re: Programming Tip of the Day

An API is a bunch of useful stuff more or less coherently organized such that it can be reused to add functionality to your program.

A framework is an API, but one crafted such that either deviating from its own style is disadvantageous, or adhering to its style is advantageous. Both need not necessarily be simultaneously true.

Author:  rdrake [ Sat Jun 02, 2007 12:47 pm ]
Post subject:  RE:Programming Tip of the Day

A variable with a meaningless name is far better than one with a meaningful, yet misleading name.

Author:  wtd [ Sat Jun 02, 2007 12:50 pm ]
Post subject:  RE:Programming Tip of the Day

And yet, both are vastly inferior to just doing it right. Wink

Author:  wtd [ Thu Jun 21, 2007 7:11 pm ]
Post subject:  Re: Programming Tip of the Day

Do or do not. There is no try.

If you firmly believe you have the best idea about how to do something, but others disagree, do not dilute your concept to try to "sell" it. Either continue to push your concept unadulterated, or give up on it and go with the crowd.

Author:  Aziz [ Mon Jul 16, 2007 1:08 pm ]
Post subject: 

wtd @ Sun Jun 25, 2006 12:13 pm wrote:
So you want to learn Java?

So why on earth would you consider understanding C important in this? It's not garbage-collected, has no object orientation support, and lacks an oh-so-important sane string type.

Well, understanding C is a bonus because Java's creator's really liked C. Someone who knows Java and understands C pointers will program in Java much more smoothly than someone who has only studied Java.


What about me, wtd? I've just recently studied C++, and as a matter of fact, I understand pointers because I understand Java and it's references.

Author:  wtd [ Mon Jul 16, 2007 1:22 pm ]
Post subject:  RE:Programming Tip of the Day

Java doesn't have references, so though I respect you, I have to question your level of understanding. Smile

Author:  Aziz [ Mon Jul 16, 2007 2:39 pm ]
Post subject:  RE:Programming Tip of the Day

Then what do you call it? Handles?

Object "references" (as I call them from this point on, for the purpose of this post), this is how I understand them to be (and I am most confident in this believe, from reading, experience and understanding, though I've been known to be wrong a few (<_<) times):

- References are created on the stack with primitives, while the object data themselves are created on the heap
- Object references are passed by value into functions, so that inside a function you could do something like: myObject.change() but no myObject = new AzizObject(). Well, you could, but the change would not be seen.

Now, correct me. (Btw, most of this info is from Cay Horstmann's Big Java 2nd edition, and I think he did call it something else....)

(You must take wtd's corrections as a chance to learn and not feel hurt . . . even if you think you know everything and he just crushed your heart...sniff)

Author:  wtd [ Tue Jul 17, 2007 12:52 am ]
Post subject:  RE:Programming Tip of the Day

A variable simply acts as a pointer to an Object in Java. That variable is not truly a reference to that Object, nor considered interchangeable.

Consider a Java method.

code:
void swap(Object a, Object b) {
   Object temp = a;
   a = b;
   b = temp;
}


Now consider a C++ function.

code:
void swap(int &a, int &b)
{
   int temp = a;
   a = b;
   b = temp;
}


Do you see the difference?

Author:  Aziz [ Tue Jul 17, 2007 7:59 am ]
Post subject:  RE:Programming Tip of the Day

So then, what is a reference? Is it the actual memory address?

I must have had my terminology messed up. And I know there's been a large debate over Java's variables. In my C++ reading, that swap method works fine, however there can be know Java method "swap" for any Object. You'd have to create a whole new object, if there was such a construction:

code:
void swap(Object a, Object b)
{
   Object temp = a;
   a = new Object(b);
   b = new Object(temp);
}


However, this isn't the same, of course.

The following code (using wtd's method, not my previous one:

code:
String a  = "I am A";
String b = "I am B";

swap(a, b);

System.out.format("A = %s%n" +
   "B = %s%n", a, b);


will output

code:
A = I am A
B = I am B


While the following code:

code:
String a  = "I am A";
String b = "I am B";

Object temp = a;
a = b;
b = (String) temp;

System.out.format("A = %s%n" +
"B = %s%n", a, b);


outputs

code:
A = I am B
B = I am A


Another thing that I wish Java would support... though it would make implementing immutable classes more difficult...

Author:  rizzix [ Tue Jul 17, 2007 12:11 pm ]
Post subject:  RE:Programming Tip of the Day

wtd assumes that the word reference is correctly associated with "C++ references".

Author:  wtd [ Tue Jul 17, 2007 1:56 pm ]
Post subject:  RE:Programming Tip of the Day

I am thinking not only of C++. I merely used that as I felt it had the best chance of demonstrating the concept in this case.

Author:  Aziz [ Tue Jul 17, 2007 2:03 pm ]
Post subject:  Re: Programming Tip of the Day

Oh dear, let's not get back into this debate. I'm going to do some "soul searching", specifically articles:

[1] http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.3 - Java Language Specification, third edition
[2] http://mindprod.com/jgloss/pointer.html - pointers : Java Glossary
[3] http://mindprod.com/jgloss/reference.html - references : Java Glossary
[4] http://javadude.com/articles/passbyvalue.htm - Java is pass-by-value, Damnit!
[5] http://www.unix-girl.com/blog/archives/000612.html - No pointers in Java?

Let me quote [4]:

Quote:
The use of the word "reference" in Java was an incredibly poor choice (in my not-so-humble opinion...) Java has pointers, plain and simple. The designers of Java wanted to try to make a distinction between C/C++ pointers and Java pointers, so they picked another term. Under the covers, pointers are implemented very differently in Java and C/C++, and Java protects the pointer values, disallowing operations such as pointer arithmetic and invalid runtime casting.

However, it makes no difference how pointers are implemented under the covers. You program with them exactly the same way in Java as you would in C or C++. The syntax is just slightly different.


The quote sums up what I believe EVERY resource I read agrees with, in one way with another. Specifically, Java calls them references. However, Java uses pointers, but implicitly more-so than explicitly. Java keeps the pointers under the hood a bit more and safeguards the use of them. And you cannot make a generic swap(Object a, Object b) function in Java, because (just like C and C++), Java is pass-by-value, meaning even the "references" are passed by value, allowing you to manipulate the object that the "reference" points to, because the reference copy still points to the same object. However, the reference is a copied value. So if you set it to another value (a = b), it will set a to b, however a is not the reference that was passed to the method, it is a COPY of it.

I don't think there should be arguments anymore of this. I think we're beating/flogging a dead horse here. Java called it reference...technically wrong, but that's what it is when you're talking in a Java environment. It uses pointers, but their a bit more shielded.

But hence there shall be more...

BTW, read the table in [3] for a humourous yet interesting analogy.

Author:  wtd [ Mon Jul 23, 2007 1:39 pm ]
Post subject:  Re: Programming Tip of the Day

Courtesy of Thom Howlerda.

Quote:
So, scrap the current Vista userland. Give the developers at Microsoft the breathing room to build an entirely new graphical user interface and other userland features on top of Windows NT. Do not make the common mistake of thinking that the programmers working at Microsoft are somehow magically less qualified than those working at Apple or on open-source projects. Various Microsoft Research projects have shown that there are a lot of bright minds among Microsoft's 71100 employees, and giving them the freedom to develop something new, without having to take almost 20 years of application compatibility in mind, could be a very wise thing to do. It would also be a morale boost among the employees.


I think Thom inadvertently hits at the crux of the matter. Microsoft has over seventy-one thousand employees.

It is the size of Microsoft which has created a bureaucratic mentality, and it is that mentality that has led to Microsoft's failures in creating software. That is what needs to be ditched, as much as or more than Windows itself. MS would be wise to take a small group of programmers and give them complete freedom to work.

Remember this: you do not improve software by throwing people at it.

Author:  wtd [ Sun Sep 16, 2007 3:31 pm ]
Post subject:  Re: Programming Tip of the Day

More of a general piece of wisdom than programming-specific, but...

Rational enemies are far better than irrational allies.

Corollary: there's no such thing as an irrational ally; just crazy people who don't realize they disagree with you yet.

Author:  wtd [ Wed Oct 24, 2007 7:46 pm ]
Post subject:  Re: Programming Tip of the Day

Think critically!

For instance, when someone tells you that F#'s big advantage over O'Caml is that it can access any .NET library, stop to think for awhile about whether this is an advantage. Many of those libraries were created to compensate for deficiencies with respect to expressiveness in the languages which spawned them. Does a more expressive language need those libraries then? If not, does having access to them really represent an advantage?

And if F# is as expressive as O'Caml, would you not feel compelled to reimplement many of those libraries to take advantage of its unique abilities?

I am not going to answer these questions, but they represent the type of questions you should ask yourself from time to time about the hype surrounding programming-related technologies.

Author:  michaelp [ Sat Jan 12, 2008 8:49 pm ]
Post subject:  RE:Programming Tip of the Day

I want more tips. There are some really useful ones in here. And I want more of them. Smile Razz

Author:  wtd [ Sat Jan 12, 2008 10:27 pm ]
Post subject:  RE:Programming Tip of the Day

This may have already been done, but from rdrake fairly recently:

If your code isn't beautiful, it's probably wrong.

Author:  StealthArcher [ Sat Jan 12, 2008 10:35 pm ]
Post subject:  RE:Programming Tip of the Day

My code shines with the glory of a thousand pure chrome rims, Is that a good thing?

Author:  wtd [ Sun Jan 13, 2008 1:22 am ]
Post subject:  RE:Programming Tip of the Day

Chrome rims are useless decoration and artifice. They are, in fact, deeply ugly.

Author:  wtd [ Thu Jan 24, 2008 12:49 pm ]
Post subject:  Re: Programming Tip of the Day

Fear not Lisp and its many parentheses for it has an important lesson to teach that only those whose minds are open can learn:

Do not waste time lamenting the fact that your language lacks feature X which would make it easier to accomplish goal Y; just add that feature yourself. If your language does not allow that, ask yourself why you bother usin a language that does not work for you.

Author:  michaelp [ Thu Jan 24, 2008 5:48 pm ]
Post subject:  RE:Programming Tip of the Day

What do you mean by add the feature yourself if the language does not have what you need it to do? A function or something?

Author:  Nick [ Thu Jan 24, 2008 5:50 pm ]
Post subject:  RE:Programming Tip of the Day

an example is Turing

Turing's GUI sucks so whenever you want buttons you make them yourself

Author:  wtd [ Thu Jan 24, 2008 6:04 pm ]
Post subject:  RE:Programming Tip of the Day

Not so much something as simple as a function, but rather new syntax, or at least something that's as good as syntax visually and semantically.

Author:  michaelp [ Thu Jan 24, 2008 7:42 pm ]
Post subject:  RE:Programming Tip of the Day

You mind giving me an example of adding something to the language? Still not quite sure what you mean.

Author:  ericfourfour [ Thu Jan 24, 2008 7:58 pm ]
Post subject:  RE:Programming Tip of the Day

Make multidimensional flexible arrays in Turing using classes.

Author:  OneOffDriveByPoster [ Thu Jan 24, 2008 9:22 pm ]
Post subject:  Re: RE:Programming Tip of the Day

wtd @ Thu Jan 24, 2008 6:04 pm wrote:
Not so much something as simple as a function, but rather new syntax, or at least something that's as good as syntax visually and semantically.
Does that count against Java very heavily? The lack of operator overloading and a "standard preprocessor" (afaik) means that things like BigInteger will never be "as good as syntax".

Author:  ericfourfour [ Thu Jan 24, 2008 9:40 pm ]
Post subject:  RE:Programming Tip of the Day

You just pointed out a feature that you might need (and can add) in Java: operator overloading. Throw in an add, subtract, multiply and divide method and you have already added the feature. Look at the equals method. These would fit nicely with Java syntax.

Author:  rdrake [ Sat Feb 09, 2008 10:25 pm ]
Post subject:  Re: Programming Tip of the Day

Quote:
My friend, the programming sage,
Says functional code is the rage.
"Go code all your hacks
with this l33t syntax,
meant for a more civilized age."


Source here.

Author:  wtd [ Wed Mar 19, 2008 12:43 pm ]
Post subject:  Re: Programming Tip of the Day

Beware your hacker instincts. Big, complex solutions to problems will look impressive. And yet... on further inspection, you may find the simpler solution more impressive.

Author:  jernst [ Wed Mar 19, 2008 12:59 pm ]
Post subject:  Re: Programming Tip of the Day

wtd @ Wed Mar 19, 2008 12:43 pm wrote:
Beware your hacker instincts. Big, complex solutions to problems will look impressive. And yet... on further inspection, you may find the simpler solution more impressive.


Haha this makes me think of fortune cookies for computer programmers Razz

Author:  Nick [ Wed Mar 19, 2008 2:21 pm ]
Post subject:  RE:Programming Tip of the Day

I remember a shuffle function I made once... I had it huge and it didn't work... I scraped it and rewrote it in < 10 lines and it worked perfectly and even faster

Author:  wtd [ Sat Mar 22, 2008 11:37 am ]
Post subject:  Re: Programming Tip of the Day

I spend a lot of time on compsci.ca talking about programming languages, and pitching various languages as being better than others for easily picking up programming concepts. I have notable disdain for certain languages. But...

If you find yourself confused, and don't know what language to start with, then even better than picking the perfect language is just picking one and starting. It's trite to say this, but the longest journey really is the one you never start.

Author:  wtd [ Wed Mar 26, 2008 4:34 pm ]
Post subject:  Re: Programming Tip of the Day

Good software with well-defined interfaces often ends up with layers of dependencies. This isn't a bad thing.

But... keep in mind that glueing those layers together does require some degree of overhead. Think about just how many layers of dependency you can afford before you end up spending more time glueing code together than writing code which actually does something useful.

Author:  michaelp [ Mon Mar 31, 2008 6:19 pm ]
Post subject:  Re: Programming Tip of the Day

wtd @ Wed Mar 19, 2008 12:43 pm wrote:
Beware your hacker instincts. Big, complex solutions to problems will look impressive. And yet... on further inspection, you may find the simpler solution more impressive.


So true. Smile
A while ago, we did a math test. It was on algebra. One of the questions was something like: "2 people ran for school president, there were 512 votes, person 1 won by 128 votes, how many votes did person 1 have? Person 2?"
Being a programmer, I used 2 variables with X and Y. X = winner = 512/2+128/2 then Y = loser = X- 128

But, someone else had a much simpler solution that I did. It made me feel like I wasted quite a bit of time on that question. Razz

Author:  Vermette [ Mon Mar 31, 2008 7:44 pm ]
Post subject:  RE:Programming Tip of the Day

The loser had X votes.
The winner had X+128 votes.
There were 512 votes total.

code:

X + (X+128) = 512
2X + 128 = 512
2X = 384
X = 192

So the loser (X or person 2) had 192 votes, the winner (person 1 )320.

I'm guessing that's the solution they used?

Author:  wtd [ Thu Apr 17, 2008 11:45 am ]
Post subject:  Re: Programming Tip of the Day

Keep it simple.

Here's one more reason why: feedback. We all need feedback. We need to know if our code is good, or if it stinks. Take for example Windows (XP or Vista). Yes, people complained about it, but the feedback Microsoft cared about, which is to say money, was not negative. Why?

Well, Microsoft in its wisdom added another variable to the equation. They put it on just about every computer out there and actively destroyed the competition. People bought Windows because they wanted a new computer. Additionally, by putting it on really cheap computers, Microsoft ensured that people would buy it because they wanted a really cheap computer.

This is not Microsoft bashing. Clearly the strategy has worked for them financially. Yet, it has failed their programmers. Those programmers feel no real pressure to improve their code when they know it will sell and be widely used anyway.

Author:  wtd [ Fri Aug 15, 2008 2:52 am ]
Post subject:  Re: Programming Tip of the Day

May have already said it, but I'm not rereading this whole thread.

Don't try to force people to do things your way. Just make sure they have no reason to want to do things any other way.

Author:  wtd [ Mon Dec 01, 2008 3:49 pm ]
Post subject:  RE:Programming Tip of the Day

Don't fear leading. Fear instead the prospect of being lead by a follower.

Author:  wtd [ Thu Jan 08, 2009 3:13 am ]
Post subject:  RE:Programming Tip of the Day

If you do something no one else is, even if it's just a novel implementation of an existing idea, and if it has value, you will be able to charge anything you want for it.

Author:  wtd [ Sat Jan 17, 2009 1:53 am ]
Post subject:  Re: Programming Tip of the Day

There are no object-oriented programming languages; just object-oriented programmers.

Author:  wtd [ Thu Feb 05, 2009 2:37 am ]
Post subject:  Re: Programming Tip of the Day

Don't spend time making your initial prototype fast.

If it's a good idea, you'll have time to polish it. If it turns out to be worthless, you'll be glad you didn't waste any more time than you already have on the dead end.

Author:  wtd [ Thu Feb 12, 2009 12:46 am ]
Post subject:  Re: Programming Tip of the Day

Open sourcing requires supreme confidence in your abilities. This is not to say it means you must be perfectly capable. If you were, there would be no need for input from others; it would be a boastful act.

Rather you must understand where your abilities are solid and where they are not, and you absolutely need to be able to take constructive criticism.

Author:  wtd [ Mon Apr 06, 2009 1:01 pm ]
Post subject:  Re: Programming Tip of the Day

Don't follow a convention that doesn't make sense to you just because it's "how everyone does things."

Of course, this is not to say you shouldn't follow conventions. You should endeavor to understand why the convention is what it is. If you understand, but it still doesn't make sense, then don't hesitate to blaze your own path, even though you may find yourself subject to the objections of your peers.

Author:  wtd [ Tue Apr 21, 2009 8:16 pm ]
Post subject:  RE:Programming Tip of the Day

There's only one way to lead: by example. Everything else is just giving orders.

Author:  wtd [ Mon May 04, 2009 8:28 pm ]
Post subject:  Re: Programming Tip of the Day

Aspiring programmers beware: when you're on a roll, you're not going to want to stop. This means a 40 hour work week might be 50 hours or even 60 hours long, and a 60 hour week might involve not sleeping for well over 24 hours.

This can be tremendous fun, and when you really start creating good stuff, it's a rush. But... it takes a toll. Make sure you can handle stress, because keeping odd hours is going to create stress.

Author:  wtd [ Wed Jul 29, 2009 2:15 am ]
Post subject:  RE:Programming Tip of the Day

Evaluate your reasons for implementing a solution.

Are your reasons simply caused by deeper problems, which if solved make your "solution" unnecessary?

Author:  apomb [ Wed Jul 29, 2009 3:00 pm ]
Post subject:  RE:Programming Tip of the Day

interesting wtd

What brought this nugget of wisdom upon the community? Personal experience?

Author:  wtd [ Wed Jul 29, 2009 3:34 pm ]
Post subject:  RE:Programming Tip of the Day

Much personal experience. Too much. Smile

Author:  apomb [ Wed Jul 29, 2009 6:07 pm ]
Post subject:  RE:Programming Tip of the Day

Hahaha well thank you for the wisdom, and hopefully we can all learn from your experience.
And to add validation (not that you need it), I can relate completely with evaluating a solution to see if by solving one problem, you have created more.

Author:  wtd [ Sat Jan 09, 2010 3:43 am ]
Post subject:  Re: Programming Tip of the Day

If you are passionate about something, and think you have a great idea, don't worry too much about others' reactions to your idea. If they tell you you're a fool, and you still think you're right after thoughtfully considering the arguments, persevere.

Consider the case of the Palm Foleo. Palm believed in the idea of a small laptop with minimal specs running Linux whose primary purpose was access to the internet (via tethering to a smartphone). The world laughed and told Palm there was no market for the Foleo, so Palm pulled the plug. Then the Asus Eee came along doing much the same in a less interesting form factor, and took the world by storm months later.

Imagine if Palm had the nerve to stick with it. We might be holding them up as the model from which the whole netbook/"smartbook" trend is derived.

Author:  ecookman [ Sat Jan 09, 2010 11:43 am ]
Post subject:  Re: Programming Tip of the Day

wow these are absolutely great! Thank you! Keep them coming!

or else....

Author:  wtd [ Fri Jan 29, 2010 5:17 am ]
Post subject:  Re: Programming Tip of the Day

One of the most vital skills you can nurture as a programmer is humility. It's important to be able to recognize code and applications that has been put in place as a temporary placeholder. Often we write quick hacks or create programs to workaround a problem, for lack of ability to implement an ideal solution. This is a perfectly reasonable thing to do.

The problem is, we also often become invested in these hacks and workarounds and maintain them even when it becomes practical to do things "the right way."

One need only look at Youtube moving slowly but surely to HTML5 video in place of Flash. Flash video was a hack to workaround a problem with no other practical solution at the time: distributing streaming video in as universal a way as possible. It was never an ideal way to distribute video, but it worked. Now we have a more ideal, more direct way to accomplish the same, and it's time to let the hack go. This is the kind of thing you should learn to do with your own creations.

Author:  kendricktamis [ Fri Mar 05, 2010 11:53 pm ]
Post subject:  RE:Programming Tip of the Day

Object-Oriented Programming is the staple of the entire Flex Framework. Some key concepts you need to know to be taken seriously as a developer are encapsulation, polymorphism and inheritance.

Author:  USEC_OFFICER [ Sun Mar 07, 2010 5:24 pm ]
Post subject:  RE:Programming Tip of the Day

Duh, object-oriented programming is important in almost every language. Except for those that don't have or need it. Actually thank you for reminding me I need to learn object-oriented programming in C++ for my new game.

Author:  chrisbrown [ Sun Mar 07, 2010 6:15 pm ]
Post subject:  Re: RE:Programming Tip of the Day

USEC_OFFICER @ Sun Mar 07, 2010 5:24 pm wrote:
object-oriented programming is important in almost every language. Except for those that don't have or need it.

Fins are important for almost every fish. Except for those that don't have or need them.

Qualifiers aren't always helpful.

Author:  USEC_OFFICER [ Sun Mar 07, 2010 6:20 pm ]
Post subject:  RE:Programming Tip of the Day

I see what you mean. I meant that some languages don't have it, and Turing doesn't really need it, and a sentence was born. (Turing is mostly for instruction. When you learn object oriented programming, you'll have moved on to C++ or Java.)

Author:  chrisbrown [ Sun Mar 07, 2010 6:36 pm ]
Post subject:  Re: Programming Tip of the Day

I will agree, though, most programmers will encounter these concepts early in their careers.

Surprisingly on-topic, here's a year-old quote from the previous page:

wtd @ Sat Jan 17, 2009 1:53 am wrote:
There are no object-oriented programming languages; just object-oriented programmers.

Author:  Tony [ Sun Mar 07, 2010 8:45 pm ]
Post subject:  RE:Programming Tip of the Day

Pro Tip: keep this thread for actual tips, and create new threads for the discussion.

Author:  copthesaint [ Mon Mar 08, 2010 12:58 am ]
Post subject:  RE:Programming Tip of the Day

Murphy's law: Anything that can go wrong will go wrong.
Make sure you back your data up Online or by disk, you never know when you may encounter a problem with your computer.

Author:  Turing_Gamer [ Mon Mar 08, 2010 8:39 am ]
Post subject:  RE:Programming Tip of the Day

Best tip for any language at any time: COMMENT YOUR CODE! It helps Smile

Author:  wtd [ Sat Mar 13, 2010 12:02 pm ]
Post subject:  Re: RE:Programming Tip of the Day

Turing_Gamer @ Mon Mar 08, 2010 9:39 pm wrote:
Best tip for any language at any time: COMMENT YOUR CODE! It helps Smile


Only if your comments are both needed and well-written. Comments as used in practice are often harmful.

Author:  wtd [ Sat Mar 13, 2010 12:06 pm ]
Post subject:  RE:Programming Tip of the Day

If you are writing software that you expect people to pay to use, then you will face the harsh reality of consumer thinking processes.

One of the most common and harmful is the use of bullet lists. Competing programs will have a certain number of features. Customers may be inclined to think your program is inferior if it does not have an equal or greater number of features. This will put pressure on you, as the programmer, to cram more and more into your software.

This *may* be the right thing to do. Or, you may need to step back and just design your program well, avoiding unnecessary feature creep.

Author:  wtd [ Sun Apr 18, 2010 7:48 pm ]
Post subject:  Re: Programming Tip of the Day

When in doubt, look at your conditionals. If different conditions involve entirely different variables, there's a good chance to you have a logic error.

Author:  USEC_OFFICER [ Sun Apr 18, 2010 7:51 pm ]
Post subject:  RE:Programming Tip of the Day

For every one hour in which you stare at a computer screen, take 5-10 minutes off doing something else. (Get up and walk around etc.)

Author:  SNIPERDUDE [ Mon Apr 19, 2010 1:02 pm ]
Post subject:  RE:Programming Tip of the Day

When in doubt, C4.
The problem often lies between the keyboard and the chair.
Hit CTRL + S as often as possible.

Author:  ProgrammingFun [ Mon Apr 19, 2010 4:50 pm ]
Post subject:  Re: RE:Programming Tip of the Day

copthesaint @ Mon Mar 08, 2010 12:58 am wrote:

Make sure you back your data up Online or by disk, you never know when you may encounter a problem with your computer.


What if the online server crashes? Mr. Green
I just keep my data on separate partitions (yes, I know a problem with the harddisk can destroy the data so I have it on 2 computers and discs).

Author:  SNIPERDUDE [ Tue Apr 20, 2010 12:23 am ]
Post subject:  RE:Programming Tip of the Day

An external HDD is a worthy investment.

Author:  wtd [ Wed Jan 05, 2011 4:15 am ]
Post subject:  Re: Programming Tip of the Day

If you set out to improve a system, and one of your goals is making sure that the users of that system won't have to learn anything new, you're almost certain to fail.

Author:  wtd [ Mon Jun 04, 2012 11:37 pm ]
Post subject:  RE:Programming Tip of the Day

What do you call a programming language that either doesn't reach out to or deliberately alienates new talent?

Dead.

Author:  mirhagk [ Tue Jun 05, 2012 7:49 am ]
Post subject:  RE:Programming Tip of the Day

Learn as many programming languages as you can, most of the languages you will never use, but it looks impressive on a resume, and each language gives you a perspective on how to code things, making your programs in your main language cleaner, faster and shorter. (I suppose the same goes for natural languages as well)

Author:  Amarylis [ Tue Jun 05, 2012 8:12 am ]
Post subject:  Re: RE:Programming Tip of the Day

wtd @ Mon Jun 04, 2012 11:37 pm wrote:
What do you call a programming language that either doesn't reach out to or deliberately alienates new talent?

Dead.


I thought it was called an apple product


: