Keeping your variables in groups allows for easier comprehension down the road. This allows your commands to be more flexible and structured. If you’ve written a command that is repetitive, you can use a single variable that contains a list value. Programmers are always trying to figure out ways to work smarter and not harder, and automating duplicate code is certainly one way to do it. Just keep in mind that leaving a note to yourself (or anyone who reads your code) explaining why a certain line of code exists can be helpful in the future. You don’t need to go overboard on the comments. This one might be a no-brainer, but we just want to emphasize how important commenting really is. But if you’re able to find a good balance between keeping it neat and readable yet also manageable, there’s nothing wrong with leaving some space between commands. Some professionals might argue that leaving too much whitespace will increase the file size or make it seem like you’re embellishing the number of lines of code. Not only does leaving a little white space look cleaner, but it also allows you to easily see and read the code you’ve written. Label variables and functions with meaning.īe descriptive when you’re labeling variables and functions to the point where you may be “overly descriptive.” You want to make sure that if you or a co-worker were to go back through your code at a later date, you’re actually able to decipher the original application.We want to make sure you’re writing the good stuff, so here are a few pointers on how to clean up your code and write with quality in mind. There’s good code, bad code, and sometimes what’s referred to as “spaghetti code” (it’s pretty much exactly what it sounds like). Despite what you may think, not all code is created equal.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |