Chapter 1

Posted on

As I mentioned in this post, I’ve been learning from a book. This particular book is called “Sams Teach yourself the C# language in 21 days” by Bradely L. Jones.

I had gotten to chapter 11 (day 11) and while some items I’d picked up really quickly, others were left in the vacuum of Michelle’s brain known as “things that make me go WTF”.

new term
A “New Term” label

So, I’ve decided that, along with writing up my progress in this blog, I’ll start this book from the beginning again and not leave a chapter unless I can explain every single crazy techno babble term in plain English. And by techno babble, I mean each time the book screams “new term” with a big black blob.

This, of course, may end up with my stating the obvious a lot of the time but hey, if I can explain things in plain English, it must mean I understand it. So I’m going to take that as a positive.

It may also mean that I spend weeks on one chapter. You’ll just have to bear with me – I can be a little “blonde” sometimes.

Chapter 1

This chapter is so *very* dry. It’s about the only part in the book I’ve found so far that completely patronises you, going into more detail about what an editor is rather than what you actually type into it. It also doesn’t really do anything code wise; just the basics about the language and how it works.

A program made in C# needs a .NET Common Language Runtime (CLR). In my source code explanation below, this would be part of the translator. You compile your code, translating it into a form the CLR can read, then the CLR takes the instructions you’re writing in C# and translates them into computer speak. If you don’t have a CLR on your computer, the program you’ve made won’t execute (it won’t work).

The benefit of using a CLR is that you only need to make one version of your program. So, if you wanted your program to run on a Windows machine and a Linux machine, you’d need two programs. I’d say that is why you often have two different install programs for Spotify, one for Windows machines and one for Macs. There’s probably more reasons, of course, but I’ll roll with this explanation for now. Kinda like how each year you went up in physics class, they told you that the stuff you learnt last year wasn’t technically true. No doubt I’ll find out I’m completely wrong later on.

Another cool thing about C# is that it was written for object-oriented programming. This is a rather nifty little idea that code can: adapt to whatever is thrown at it (polymorphism); be recycled (reuse); using existing code, and adding to it (inheritance) and have chunks of code for each of the tasks it needs to perform (encapsulation). Funnily enough, despite it being quite complex, this is about the only thing I actually learnt at uni.

OOP’s chunks of code are referred to as classes, and these classes create objects. The book actually shocks me here and uses a reasonable explanation of how objects and classes work. A class is the definition and the object is the item that is created. The example the book uses is that a class is a cookie cutter, and the object is the cookie itself.

Terms

These terms are written as I understand them.

Leave a Reply

Thank you for choosing to leave a comment. Comments may be moderated.