Answers to the Software Philosophy Quiz
Please put feedback and comments on this blog so they don't get lost in other media.
1. When you are writing code who is the most important person you should be thinking about?
- The customer/user/manager/boss
They never or rarely look at your code
- Yourself
Have you ever worked on your own code after a long gap in time? I once worked on mine 10 years after I first wrote it. Boy, was I a dummy when I wrote it. You may be the maintainer or you may not.
- The Maintainer
Write your code as if the maintainer is a homicidal maniac who knows where you live!
2. Other than comments what is the most important human/artistic aspect of code?
- Formatting
There are auto-formatters.
- Readability
Readability is a result of good coding. It is not an aspect of code.
- Names!
There are dozens of different things to be named in code. And the computer doesn't give a shit about any of them. Names are only for code readers. Much more on name selection in a future essay.
3. We mentioned comments. What is the number one purpose of comments?
- Why!
Why did you call that sub? Why are you checking that value? Write your comments to answer WHY!
Bonus: This is a trick question so you must think INSIDE the box. What is the opposite of spaghetti code?
- Ravioli Code
I will usually give a 1/2 point for this. It shows some understanding and it is a pasta. But all of those who gave this answer like the correct one better.
- Lasagna Design
Layers of code is the pasta!
Remember These Corollaries:
Code is for people, NOT computers
Code is for other people, NOT yourself
Code is what, comments are why
Complexity Arises from Layers of Simplicity
A few thoughts... When answering (2) my reply was "style," which sits above and encompasses all of the sub-items you listed. As far as (4) goes, to me procedural programming is lasagna code due to its hierarchy and layers, while ravioli is a good metaphor for OOP. But either way they're both tasty.
ReplyDeleteyou can't define style as it is way too subjective. style doesn't communicate to the reader. names do communicate.
DeleteStyle includes and incorporates the subjects you listed: naming conventions, comments, formatting, and readability. Beyond coding style, software style also encompasses architectural styles, which define the overall structure and organization of a system. It is not subjective and there have been many texts written specifically on the subject.
Deleteformatting can be automated. style and readability are subjective as i stated and can't easily be taught. names are still the most important human/artistic aspect of code. wait until my names essay is written.
ReplyDelete