UML #
Since there isn’t a way to pass a new DisplayPanel
object into the constructor, it is a composition.
Example CRC card building
Clean code #
Design principles #
“The Art of Clean Code” video #
Summary:
Victor Rentea’s clean code video had a lot of amazing information for making sure that the code you write is considered “clean.” I think that clean code is a very important part of being a good programmer because it conveys the sense that you care about your team’s ability to read your code.
My biggest surprise after watching the video was that writing clean code has little to do with the actual formatting of your file. Instead, it has to do with the way you organize your file. Simple things like making sure that each function is only doing one thing, and not adding ambiguous words to your class/function names. Another big aspect of writing clean code has to do with the continual refactoring and maintenance of your code. To sum up Victor’s ideas: once your code works don’t consider yourself done. It takes an ongoing effort to maintain clean code because of the ever evolving nature of software engineering.
Another very interesting aspect of Victor’s talk had to do with comments. Comments can easily become redundant if the code you are writing follows good naming conventions and isn’t obfuscated in any way. Victor explains that you should always be able to express what your code is doing with code, and comments will fall out of sync with code when it is inevitably changed in the future.
A good point Victor had was on the topic of OOP. It is a common misunderstanding that just because your class has private fields and public accessors that you are practicing OOP. He explained that most business logic will lend itself nicely to procedural code, and that you can successfully utilize OOP by putting short and simple procedural code inside what he called “logic containers.”
Overall, all of his explanations were very good and should make a lot of sense to someone who strives to write clean code, myself included.