I wanna be a triple-threat

Sep 26, 2010 01:01

So I'm finally taking a CS class after years of working in IT. Basically, this means I'm learning some programming. The professor is using Python and the text by Zelle. It's fun, but I keep finding myself saying: "I can brute-force it this way, but there *has* to be a better, sexier way to do 'this.' (Whatever 'this' is at the time ( Read more... )

Leave a comment

Comments 2

dr_tectonic September 26 2010, 17:04:06 UTC
The jargon term for better, sexier code is "elegant".

One thing to remember is that often, a straighforward brute-force approach *is* the most elegant solution. It turns out that humans are really, really bad at figuring out what takes a long time to execute and what doesn't, and many programmers waste a lot of time and effort on so-called "premature optimization". The way to write good code is to write something that is clear and easy to understand, and then to see if there are parts of it that need to be improved.

Reply

bryree September 26 2010, 19:31:24 UTC
Ah! Thank you sir. I shall continue the beatings. :)

Reply


Leave a comment

Up