2017-08-12 - Don't Plan Outcomes
I like planning. It makes me feel better to know what I'm going to do, or what I have to do. I also find that having a plan for what I want to accomplish helps me to be more productive and that it encourages me to be more diverse in my activities. That being said I've found that you need to be careful what you plan for.
When planning it's important to focus on what you can control. I think people have a tendency to focus on what they want to happen. I'm going to get a job, I'm going to buy a couch, I'm going to finish this project. I'm going to win the lottery. The problem being that sometimes you don't have the ability to make what you want to happen happen. You can make yourself look for a job but you can't make people give you one. You can make yourself look for a couch but you can't make stores have the one that you want. You can make yourself work on a project but you can't guarantee you're going to finish it. You can buy a lottery ticket but you can't pick which numbers will win.
If you plan to finish a project and you don't then you have failed which can be bad for your motivation to try again. If you plan to work on a project then you can consider the plan a success as long as you actually did work on it, even if you didn't finish it. it becomes a lot easier to feel good about the effort you did put in rather then what you didn't manage to do. Then you can plan to work on it more some other time.
The other week I wanted to finish a chapter of the F# book I've been working through. I ran into so many issues working through the examples that I wasn't able to finish. The version of the plugin the book was using didn't work with the version of Visual Studio I was using. The version of the plugin which worked with the version of Visual Studio didn't work with the code from the book. Even after I managed to downgrade the version of the packages to match the book I still had issues running certain examples. I only managed to finish the chapter because I figured out which parts were causing issues and skipped over them. Which goes to show that just because you attempt something doesn't guarantee you can complete it. Sometimes the universe conspires against you and it's not really fair to blame yourself for the universe.
So when you are planning things focus on what you are going to do rather then what you want to happen. It will make it easier to feel good about what you have done rather than feeling bad about what you haven't managed to do.
2017-07-18 - Parts of Speech: Pronouns
Pronouns replace nouns which have already been introduced or can be determined from context. They are used to simplify sentences and allow us to talk about something without having to use its full name every time. For example instead of saying "The head doctor ran down the hallway and then the head doctor slid into the operating room" you can say "The head doctor ran down the hallway and then she slid into the operating room". Pronouns are special because they have a lot more forms depending on the person, number, or case of the noun they are a replacement for.
The person of a pronoun refers to the relationship between the person talking or writing and what they are referring to. First person pronouns refer to the person or thing speaking or writing (I). Second person pronouns refer to the person or thing being spoken or written to (you). Third person pronouns refer to someone or something outside the interaction (he, she, it). The number of a pronoun refers to the number of entities being referred to. Pronouns can be singular (I, you, he, she, it) or plural (we, you, they). The case of a pronoun refers to how it is used in relation to a verb. Pronouns can be used as the subject (I, you, he, she, it, we, you, they) or object (me, you, him, her, it, us, you, them) of a verb. Together these simple forms of pronouns are referred to as personal pronouns. Not because they deal exclusively with people but because they change form based on the person (First, second, third) being used.
Reflexive pronouns are used when the object is the same entity as the subject and usually end in self (myself, yourself, himself, herself, itself, ourselves, yourselves, themselves). The possessive form of a pronoun is used to indicate possession or ownership (mine, yours, his, hers, its, ours, yours, theirs).
There are also a lot more pronouns that can used in certain situations but these are good enough to start with. We may talk about the others at some point. Next time I want to talk about articles.
2017-06-24 - In IL: VB Grade Analyser (Select)
The Visual Basic .NET Select statement is a lot like the C# switch statement. The two have similar syntax and are used for similar purposes but the VB version provides more options. For example the C# switch statement requires exact values where as the VB Select statement allows you to enter conditionals.
Let's start by looking at a Select statement which performs the same operations as the switch statement from part 10.
As you can see the syntax of the Select statement is very much like that of the switch statement. Now let's look at the generated IL.
The generated IL for the Select statement looks almost identical to that generated for the switch statement. This is to be expected since the two programs are doing the same thing.
Now we're going to change the program to take numerical ranges instead of characters.
This program isn't that different from the first one except for the variable being checked and the cases. If we compile this into IL however we see it's quite a bit different.
Gone is the switch instruction and the individual cases. Now we have a series of jumps. If you go back a few parts this actually looks like an If-ElseIf ladder. Which is how we would likely write this kind of code in C#. This goes back to what I've said before which is that the compiler is there to help you and make things easier. You don't need a Select statement which can accept ranges because you can already do that using If Else statements and the generated code will be the same in either case. The benefit of the Select statement accepting ranges is not in what it allows you to do but in how it allows you to express what you want to do.
Next time we are going to start looking at loops.
2017-06-04 - Computers were Created by Us
The problem with a lot of scientific disciplines is that they are trying to understand and rationalize the universe and the universe has very little interest in being understood. Every time we think we have it figured out something new comes up and turns everything upside down. Isaac Newton figured he had a good handle on the whole gravity thing. He said it was the attraction between objects with mass. That worked rather well to explain the orbits of the planets. Albert Einstein thought about it and decided that didn't quite work. He figured gravity was actually just an imaginary force caused by the curving of space-time due to massive objects. Now physicists are working to come up with a quantized model of gravity which fits into our current understanding of quantum mechanics. The more we learn about the universe the more complicated our models become.
Computer science on the other hand is about understanding things we ourselves have built. Computers are as simple as we want them to be because we built them to be that way. There's also really handy manuals and diagrams to explain how things work. If worse comes to worse and you still don't understand something there's a chance you can track down the person who's responsible for it and ask them why.
The benefit of this difference is that computer science is a lot more accessible than other fields. We are in control of every concept and idea which exists in computer science. We decide how things work. Now that's not to say computer scientists can't be weird and come up with weird concepts. It's just that there's usually an easier to find explanation. Instead of questions like "Why can particles jump through walls?" we have questions like "Why are the keys on a keyboard arranged the way they are?" which are a lot easier to answer.
This is one of the reasons I find working with computers to be appealing. I know that whatever I am trying to figure out it made sense to someone. If they can understand it enough to build it then I can understand it well enough to use it.