C# WPF program question....
A concept several more experienced programmers on the forum told me is to write code that should be self documenting.
For instance, your variable _currentTime doesn’t need a comment saying it triggers every time as it should be expected to have the most up to date time in the program.
You call a method called dlg.ShowDialog() with a comment saying “show dialog box.”
The method name does one thing. It shows a dialogue box. Things like the above don’t need to be commented because anything ending in () is a method & every method should do 1 thing.
I reserve comments for complicated things. IE some sort of mathematics forumula.
I won’t comment addition, but if I use the quadratic formula, at the very least I’ll put a comment saying “quadratic formula.” At best I’ll explain the formula.
This could all depend on your teacher. I’ve gotten renouned from my teachers for saying “using self documenting code...” as a lot of code doesn’t need comments. It’s generally expected that someone reading your code will understand both the language & English.
Your use of summaries is liked by me as it explains how to use methods. Saves me the time of having to research the documentation if there even is any if I need to extend your code.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now