We are accustomed to see men deride what they do not understand, and snarl at the good and beautiful because it lies beyond their sympathies. — Goethe
Okay, time to get a little more professional again: Let’s clean up our code a little.
Writing in good style is really important, so today I’ll show you a bit about refactoring. Especially, we want to create short, clear methods. (The technical term for it is cohesion – we want highly cohesive methods.)
Even if you’re not that interested in discussion of underlying concepts, but just want to GET STUFF DONE — still, watch this video. You can only become a good programmer (and get stuff done) if you understand what you’re doing.
I really want you not only to copy what I’m showing you, but become able to invent and create your own programs. For this, it’s important to get the concepts.
So, hit start, sit back for a few minutes, and learn something!
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. — Brian W. Kernighan.
We’re leaving the ‘Trick, the turtle’ scenario this week to make something new completely from scratch.
The main purpose here is to piece together everything we have seen to far about the structure of a class, and create a complete new class (with fields, constructors and methods).
Yes, I know, this doesn’t sound too exciting. I can see from the video view numbers that videos dealing with review of concepts aren’t quite as popular as the ones showing new stuff.
So: Don’t worry. I’ve thrown a few interesting new things in as well: dynamically changing images, string concatenation and multiple constructors are some of them. Oh yes, and a first run-in with a runtime exception!