Depending on their salary, that could be hundreds of dollars down the drain in wasted development time. And they will waste four hours trying to fix it, to realize just as you did is that third-party-extension requires a string is why. Even if it’s a personal project, there will one day be a time when another developer has to read your code and figure out why you used a string instead of integer. The idea that you should or could just code something that technically works in every other way, but is not human readable is incredibly arrogant. In fact, more time is wasted trying to decipher confusing code, dealing with a lack of documentation, or having to fix other people’s code (which is another bad practice - make the offender refactor their own code, don’t do it for them - or you’ll be the code janitor, cleaning up other people’s messes all day). Some people may say “it’s a waste of time.” It’s not. Pretty code is important because readability is important. In fact, some people even argue against this entirely. Some of this might seem OCD imposed on you by those kind of coworkers who spend more time judging your skill as a developer than actually writing their own code. Don’t be a coding lone wolf, join the pack. Use dashes ‘-’ for HTML, use underscores for ruby, etc. So don’t use it in a language where it’s not accepted (even if your code compiles). Do you write your emails in camelCase? Do you text your friends in camelCase? No. If you put camelcase on everything, you’re doing it wrong. Stop the camelCase madnessĬamelCaseIsGreat… in languages where it’s the commonly accepted practice. Confluence) for your app or for individual components of your app and link to it in your comments. I’m using an object to store my users because I have data //that needs to be placed in an object because objects are better //than arrays for layered data BECAUSE I SAID SO YOU STUPID CHILD const userObject = Literally, it should read like an argument you are having with a toddler who keeps asking ‘why’ like it’s a game. While your writing code, use comments or companion documentation to justify what your doing. Not x, not ‘usrC’ or even ‘usrCount.’ Use real, full words anybody can understand. For instance, when creating a variable that is a count of your app’s users, you name your variable ‘userCount,’ or something equivalent. Your coding objects should be properly named. Properly indent your code, do not use tabs - use spaces (most editors/IDEs have a setting for this, 2 is my recommendation for most languages), remove unnecessary spaces between lines of code, and add an extra line to end of your document (yes, this is still true). Your code should be properly formatted in the document. There are 3basic tenants to pretty code that I completely invented based on my entirely subjective experience. This includes some very OCD ideas, like using spaces instead of tabs, the # of spaces to be used having code properly indented, and naming your functions/objects/classes/variables/etc correctly. Pretty code, which if you’re not familiar with, is the idea that all code should be written (and refactored before being accepted by peer/manager review) to match commonly accepted principles to naming, spacing and syntax.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |