While learning to code, I’ve been introduced a more than just programming languages. There’s lots of coding specific phrases and jargon to learn too. I’ve started a little cheat sheet of terms to know and interesting code specific phrases. In my last entry, I touched on where the term “bug” came for in computer programming (coined by Grace Hopper when a moth flew into the machine). Now, I’ll be sharing some of my cheat sheet of terms with you.
In this past week of class, we had a lab on refactoring. Refactoring happens after you’ve written code that works. The first go around may not be the prettiest code, so you go back in and improve upon it without changing it’s external behavior. This process is called refactoring.
Refactoring plays into the next pair of terms on my list: syntactic vinegar and syntactic sugar. When you’re writing a program, you can get it working in so many different ways. There are better ways, and more messy ways. The messy ways may be easier to break, or just could be simplified significantly. Syntactic vinegar refers to those messy ways. Syntactic sugar is the opposite. It refers to a program that is written elegantly and sweetly.
A phrase that’s come up a number of times is “keep it DRY”. Dry means “don’t repeat yourself”. When you’re writing code, you strive to not repeat yourself. If you’ve written a method in one class and the same method in another, you could refactor it to store the common methods in a parent, or super class. Sounds like syntactic sugar to me. Then the subclasses can both inherit the common methods. While browsing around, I came across the term wet programming. It’s a joke on dry programming, meaning “write everything twice”.