-
Notifications
You must be signed in to change notification settings - Fork 1
Design Guidelines and Principles
MyMICDS was designed with a couple of ideas in mind to keep the website as stress free and low maintenance in order to ensure the website can run without constant maintenance. Because of this there are a few principles to keep in mind when considering new features.
Any features should generally be able to work without any regular, active maintenance. Some exceptions to this are April Fools.
When programming, your code not only needs to function, but it should be consistent, maintainable, and adhere to DRY (Don't Repeat Yourself) and KISS (Keep It Simple, Silly).
Ensure that if you do a thing a certain way, you do it consistently throughout the rest of the codebase.
For instance, if I write my functions like this in 99% of my codebase:
function doSomething() {
// do stuff here
}
and I then write this:
function doMoreStuff()
{
// do stuff here
}
It is inconsistent. While this is a relatively harmless example on its own, these inconsistencies can build up into creating a spaghetti code base. Also consider the way I named the functions. I didn't name the second function do_more_stuff
or DoMoreStuff
because it would have been inconsistent naming.
Code should readable, the variable names should be fairly easy to understand to anyone reading the code (including you 3 months later), and the purpose for everything should be understandable. Use comments to help people understand why things are done the way they are, not what they do. For instance, instead of commenting:
// Set x to 1
Something like:
// Skip the first item, which is empty
is much more useful. This is not something that comes easily, but its good practice to start trying sooner rather than later.
Linters help with both of these. They check for formatting inconsistencies. MyMICDS.net uses linters to [TODO FINISH]
Clean Code is a great book on how to achieve consistent readable code, but it isn't a must read unless you plan on making programming a career.
If you have any issues contact [email protected].