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... )
Comments 2
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
Reply
Leave a comment