Git serves a few purposes in your project. One of those purposes is a safety net. It allows you to make experimental changes to your code, and not have to worry about paying much attention to the state it was in when you changed it. That state is already available through one of your commits if you need it. There are three primary ways I turn back the clock in Git: reset; checkout; and revert. Let’s take a look at the reset command.
Month: February 2017
WPF Window Exercise
I had a situation here where I was trying to figure out how to create a WPF window from a console application. I couldn’t use the application class, and found it to be a nice little exercise. As it’s an extremely rare case, I don’t expect it to be useful again, but I found it interesting, and decided to document it, and write it here. Enjoy.
git diff
Overview
There are times when you need to know what was changed between two points. Examples are: your last commit, and your working tree; two commits; two tags; two branches; a tag and a commit.. and on. Mostly, you’ll need to know how your working tree differs, or how your staging area differs from the last commit made. For this, as you have undoubtedly already guessed, is what the git diff
command is for. Let’s look at common uses of this command.
C# Interfaces
What are interfaces?
An interface is functionally equivalent to having an abstract class with only public abstract members being events, getters, setters, and methods.
So, why not abstract classes then?
Interfaces can do one thing that abstract classes cannot. Interfaces can inherit from multiple interfaces whereas abstract classes can only inherit from one class.
So, why ever use abstract classes?
Well, abstract classes are still useful. You can place code needed by all subclasses in the abstract class. Sometimes, I will create my inheritance model using interfaces, and then use an abstract class to set the table for the classes that will inherit from it. This helps to adhere to the DRY principle. Don’t repeat yourself!
Well, okay… but which is better
What’s a better hand tool? A hammer or screwdriver? The answer is neither. They both have their uses, and both can be horribly misused. The same thing goes for interfaces, and abstract classes.