Procedural and Object Oriented Programming

Introduction

Now that we have our Visual Studio Development environment setup and have some background in software (check out my previous posts) let’s start looking at Procedural Programming and Object Oriented Programming (OOP). During this post I want us to take a quick look at the history of the two main methods of software development, that is Procedural and Object Oriented, the differences between the two and then delve deeper into OOP. I started my introduction to programming with procedural before moving into OOP using C/C++ and as I will be focusing on using C# for most of my posts we’ll be taking a far larger look at OOP than procedural. So let’s get started…

Procedural Programming

Procedural is where we have variables, that is a container we use to hold our data, and procedures/functions, this is a defined section of code that performs ideally a single task (I say ideally because this isn’t always the case, I’ll be producing a post on some programming principles where we’ll cover these in more details) based on some information it may require and may or may not give something back, lets see an example:

In the case for the variable, our data the system will hold, which would be considered it’s ‘state’, we’d normally find the data held in variables (check out What is a Program? for more info) such as

int age;
string name;

The example above shows two variables,

  • An int called age
    • An int is a whole number, it cannot have any decimal places.
  • A string called name
    • A string holds characters, that is letters, punctuation, and other symbols

So with age we can store any whole number and if we want to get to that value we use the name ‘age‘ to do so, the same applies to name, we can store someone’s name in the variable and if we want to get the value of name we just use the variable name to get access.

For both of these variables we’ve given them useful names and can assume they are related to a person in some fashion.

Quite straightforward for variables, now let’s take a gander at functions, which would be considered the systems ‘behaviour’:

int add(int x, int y)
{
    return x + y;
}
  • The first word ‘int‘ is the data type that will be returned from this function
    • Returned means at some point, normally the end, the function gives data back using the ‘return’ keyword to identify what holds that data.
  • The second word is the name of the function ‘add‘, callers to this function will use this name to tell the system that is the function they want to use.
  • The opening parenthesis ‘(‘ is used to identify the beginning of the values the function expects to receive, this is called a ‘parameter
  • Now, we need both the ‘int‘ and the ‘x‘ for this bit, the ‘int x‘ section tells you we want an int called ‘x
    • Think variable.
  • The use of ‘,’ is simply to separate parameters so if the function expected 3 parameters it would be:
int add(int x, int y, int z)
{
    return x + y + z;
}
  • The opening curly brace ‘{‘ is used to define the start of our scope, scope is simply the start boundary for our function and the closing curly brace ‘}’ defines the end of our scope.
  • The content of our function, which is very small, is found on line 4
    • All we do here is add x and y together then return that new value as an int, quite simple.

Let’s take a quick look at a very simple program (in C++):

// So this is our function, we expect to be given two values x and y
// and we'll give back a new value which is the result of adding x and y
int add(int x, int y)
{
    return x + y;
}

// As mentioned in a previous post, this 'main' method is quite important 
// and is the starting point for a lot of programming languages, in this case C++
// We'll not be looking at that here though
int main(string[] args)
{
    // Our first variable of type int called starting_balance and it has been assigned a value of 100
    int starting_balance = 100;

    // Our second variable of type int called deposit_amount and it has been assigned a value of 50
    int deposit_amount = 50;

    // Not here is our third variable called end_balance but it is not assigned an amount directly instead we are 
    // calling the add method and passing the starting_balance and deposit_amount variables to the function.
    // Which we expect the add function to return another int to us, and it is that value we are assigning to 
    // end_balance (which is 150)
    int end_balance = add(starting_balance, deposit_amount);

    return 0;
}

The above is not a very useful program mind you but hopefully proves the point.

So that is an exceptionally quick and shallow overview of Procedural Programming but gives us some useful information and I hope shows we can develop anything we want really. My background has been more focused on Object-Oriented so let’s move on to that.

Object-Oriented Programming

Now then let’s check out Object Oriented Programming (OO or OOP)…

In our look at Procedural Programming, the state and behaviour do not really have a strong relationship, in the world of OOP that is not the case. The Object in OO refers to an entity within the OO domain and that object contains both the state and the behaviour, that is the variables and the functions, which in this context are generally called attributes and methods respectively. An object is a self-contained representation of ‘something’, such as a person, shape, car, or anything else, that has both state and behaviour.

The reasoning here is how do we prevent anyone from changing the state within a procedural program? It’s a bit difficult, so by wrapping state and behaviour up in a nice object, which is defined in something called a class, we can control access and manipulation to that state, we call this Encapsulation (and it is one of the ‘Pillars of Object-Oriented Programming’) because we’ve ‘encapsulated’ both state and behaviour within a single container. The next stage is the use of data hiding, another principal in OO, here we restrict how that state is changed and only allow specific ways of changing the state. That would be by the use of those methods mentioned earlier, that way we can ensure only changes we allow can be made to our state. The really nice thing about this is by restricting access to an objects state we prevent any accidental (or intentional) corruption of that state. We can, and should, hide a lot of the internals of an object from the outside world by use of access modifiers, that is we only provide very specific methods to change an objects state and we hide everything else. The easiest way I find people understand this is by thinking of a car, now not everyone fully understands how the internals of a car work, for example how exactly a combustion engine works, and because of the design of a car, you really don’t need to know this. All we, the driver, need to know how to do is to make the vehicle move that is switching the car on, steering it, accelerating, braking, changing gear, adding fuel, etc, you only need to know how to operate it you don’t need to worry about anything else. So as programmers we can do the same, we can provide users of our objects with simple methods and hide anyway all of the complexity.

So there are a few terms in the previous paragraph that need some explaining, (right?):

  • Attribute:
    • An attribute is a variable held within a class, it should not be accessible to the outside world
  • Method:
    • A method is a function held within a class, it can be accessible to the outside world or hidden
  • Class:
    • A class is simply a blueprint for an object, we use classes to define attributes and methods within a container
    • Another good analogy is a blueprint for a house, we use the blueprint to define how to build a house but it is not the house itself
  • Object:
    • Using the above analogy an object IS the house, it is what we have created from the class, the blueprint
  • Access Modifiers:
    • Access Modifiers are keywords we assign to our attributes and methods, this allows us to control access
    • For now, think of there being just two access modifiers:
      • Private: This means only the class has access to the attribute or method
      • Public: This means any entity can access the attribute or method held in a class

I think it will be worth looking at an example (in C#):

// Here we use the keyword class to identify we are creating the blueprint
// We have called the class Person, similar to how we create variables; 
// start with the type, in this case its a class, then give it a name, 'Person'.
public class Person
{
  // So here we are defining 3 attributes, notice the access modifiers.
  // The first is an int called age, we give it an initial value of 0
  private int age = 0;
  // The second is a string called name
  private string name;
  // The third is a string called message
  private string message;

  // Here is a method we have set to public, this means the method can be 
  // access by any holder of a Person object.
  public SetNameAndAge(int newAge, string newName)
  {
    age = newAge;
    name = newName;

    // UpdateMessage isn't available to anything outside of the scope of the class
    UpdateMessage();
  }

  // This is our first private function
  // The type 'void' means we do not return anything from the method
  private void UpdateMessage()
  {
    // So we update the message variable to the following
    // The use of quotes defines a string
    message = "Hello, " + name + ". You are " << age " year(s) old.";
  }
}

This is a very simple class but I hope it helps to show some of the above content in an actual example, check out my previous post as well about What is a Program? to add some additional value.

Why Object Oriented?

Ok so we’ve had a very quick look into OO, but why would we want to use it instead of saying Procedural. I’ve touched in it very slightly above but because of the Four Pillars of Objected Oriented Programming. They are:

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

we’ll be looking at the Four pillars exclusively in another post, so keep an eye out for that.

I hope you’ve found this post a little bit useful and if you have any questions or there’s something I haven’t explained very well please feel free to get in touch.

I welcome feedback, especially at this very early stage, so any improvements you think I can make please get in touch either in a comment below or send me a message and I’ll get back to you.

Setting up a Visual Studio 2017 Environment

Intro

Hey all, so today I’m going to give you a quick run through for setting up a development environment using Visual Studio 2017 Community on Windows 10. There will be a tutorial on how to do this on a Linux environment with a different IDE but for now as I will be focusing on Visual Studio for development.

Not much else to say there, let’s get into it…


Steps:

Up to date Windows 10

The first thing we want to do is ensure that our Windows 10 development machine is up to date.

  • This can be found in Settings -> Update & Security -> Windows Update

Download Visual Studio 2017

Now we are happy our machine is up to date next we want to download the Visual Studio 2017 installer. So the next thing we want to do is download Visual Studio 2017

  • There are other versions available for those with the required Key or Subscription level, they are:
      • Visual Studio 2017 Professional
    • Visual Studio 2017 Enterprise

We will only be looking at Community Edition, but the steps will be the same.

Install Visual Studio 2017 Community Edition

  • Once you’ve downloaded Visual Studio lets install it

  • Double click on the installer
      • You’ll find it in your Downloads folder normally set to ‘C:\Users\<Your Username>\Downloads’
    • You may need to approve the installation via the User Account Control authorisation window. I assume as you are here you’re happy to install Visual Studio 2017, so click ‘Yes’

  • Next up will be to review Microsoft’s Privacy Statement and Software Licence Terms
    • Pretty standard stuff.
    • Click ‘Yes’

  • The Installer will then fetch and install some additional dependencies

  • So, now we get to configure our Development Environment. For our purposes I’m only going to choose those components we MAY want to use in the future, that is components I intend to use in any posts I make. You can, of course, install any components you wish outside of my choices. So we will want:
      • .NET desktop development
      • Desktop development with C++
      • Universal Windows Platform development
      • ASP.NET and web development
      • Azure development
      • Python development
      • Data storage and processing
      • Mobile development with .NET
      • Visual Studio extension development
    • .NET Core cross-platform development

NOTE: You will need to ensure you have enough space to install the components. Please see the red box the above image it shows the ‘Total space required’ for your configuration.

    • You can change where you want the installation to go, see the green box in the above image
      • In some cases, some of the components will have a set installation path which you cannot change.
  • That’s it, for now at least, the Visual Studio Installer will now install Visual Studio, this will take a little while. Could be worth grabbing a brew or something and if you haven’t done so already check out some of my other posts.

Start Visual Studio 2017 Community Edition

Great, so Visual Studio should now be installed for you, I recommend you restart your machine but it’s not necessary. Let’s open Visual Studio now then, there’s a couple of ways to do this:

  • Start Menu
      • Open the Start Menu using the Windows key
      • Scroll to ‘V’ named apps
    • You will see ‘Visual Studio 2017’, click it.
    • Desktop Shortcut
        • Navigate to your desktop, press Windows Key + D
      • Double click, ‘Visual Studio 2017’
  • Search bar
      • Open the Start Menu by pressing the ‘Windows Key’
      • Type ‘Visual Studio 2017’
    • Visual Studio 2017 will now be in the Start Menu Best match options

There will be some configuration we need to do as part of our first startup

  • You’ll be asked to sign in to your Microsoft account if you have one.
    • If you don’t, I’d recommend you get one and sign into it.
    • If you do, sign in
      • Especially if you have an MSDN subscription
  • Next up and nearing the end, some simple IDE configuring
    • Leave Development Settings as ‘General’
      • Though feel free to look into this in more detail and selection and option more suitable for your plans
    • Then choose your Color Theme

We are done, Visual Studio  2017 will now be installed and you can take a look round if you want.

Hopefully, my steps were useful and you managed to install it. If you have any problems feel free to get in touch and I’ll help in any way I can (though I imagine you’ll likely google any issues).

Next up then we’ll make a very simple C# application, should be out shortly.

What is a Program?

What is a Program?

We’re going to look at some rather interesting stuff today. If you’ve read my other posts you’ve probably been thinking “When are we going to start coding dude?” but I wanted to give you at least a small introduction to the larger picture before getting stuck into actually writing any code, don’t worry though we’ll be looking into that shortly

So today I wanted to take the time to look at What a Program is (see What is Computer Software? for more information) and how we can create them. I hope you enjoy this part of your introduction I know I did quite a few years ago.

What is a Program?

Essentially, a program is just a set of instructions given to a computer to solve some problem or to perform a task. So if we wanted to work out someone’s annual business mileage, we would do the following.

  1. Ask the user “How many miles do you drive for work per day?”.
  2. Wait for the user to provide us with the number of miles.
  3. Store that number in memory using something called a “variable”.
  4. Ask the user “How many days in a year do you work?”.
  5. Wait for the user to provide us with their days.
  6. Store that number in memory using a variable.
  7. Create the user’s mileage by multiplying the number of miles by the number of days, also stored in memory using a variable.
  8. Display the annual mileage to the user on the screen

As a whole, the above steps would be called an algorithm (we’ll be looking at Data Structures and Algorithms in the future). For right now an Algorithm is just a collection of clear logical steps used to solve a problem or to perform a task. As you can see we perform the above steps in the order given and we will get the output we expect, while some elements could be rearranged we can’t perform steps 7 and 8 before steps 1-6.

One thing we must be absolutely clear about is that a computer does ONLY what we tell it to do, unlike us (humans) it does not interpret the meaning of things, it does exactly what it is told to do. So how do we use the above steps to tell a computer how exactly to do what we want, there are a few steps involved:

  • The first is we need to use is a programming language to put our intent into a human-readable format using code
  • The next is to convert out intent into a format the computer can interpret
    • This has several steps:
      • In some languages, we turn it into something called object code
      • Then we convert the object code into a machine-readable language, 0s and 1s called binary or machine code.

What is a Programming Language?

A programming language is just a way in which a human can provide their intentions to a computer. We have two categories of languages that we use:

  • Low-level
    • This language category resembles something closer to Machine Language
  • High-level
    • These languages resemble something closer to a human language

Low-Level Languages

We won’t be looking into these languages (for now at least anyway) but as mentioned these languages tend to resemble Machine Language and for a lot of your programming tasks won’t be something you need to have a great understanding of. Having said that it doesn’t hurt to have a quite overview.

Depending on how low into the Low-level category we are, the code itself may run directly on the computer, being executed by the CPU (check out my post on Computer Hardware if you haven’t already), and this would be called Machine Code, there are some further steps such as Microcode, I won’t be going into that but feel free to check out google if you’re interested.

We also have Assembly Language, this is classed as any low-level language that has a strong relationship with a program and the machine code instructions. As mentioned, I don’t intend to look at this in much more detail but we’ll see how things go.

High-Level Languages

Now that we’ve had a, very brief, look at Low-level languages lets check out some more high-level stuff. There are a lot of high-level languages that have been developed over the years and we’ll discuss the differences between the language types later:

Language Description
C A general purpose language. Developed by Dennis Ritchie for Bell Labs between 1969 and 1973. Many languages are related in some way to C.
C++ A general purpose language and based on the C language. Developed by Bjarne Stroustrup in 1979 to add “classes” to C. We’ll check out classes in a later post.
C# A general purpose language and is part of the C family of languages. Developed by Microsoft and used with the .NET platform.
Java A general purpose language developed by Sun Microsystems and now owned by Oracle. This language is not linked to JavaScript
JavaScript A general purpose interpreted language and is one of the core technologies involved in the World Wide Web. Originally designed by Brendan Eich at Netscape. This language is not linked to Java.
Visual Basic An event-driven Windows-based programming language used to create applications quickly. Developed by Microsoft and used in the .NET platform.
ADA A general purpose language used predominately within the defence and aviation sectors. Named after Augusta Ada the Countess of Lovelace who is regarded as the first programmer.  Developed by the US Department of Defense in the 1970s
Ruby A general purpose interpreted language quite popular with programs running on web servers. Developed by Yukihiro “Matz” Matsumoto in the mid-1990s.
Python A general purpose interpreted programming language. Quite popular in commercial and academic domains. Developed by Guido van Rossum in 1990.

High-level languages allow humans to provide instructions to computers in a format that we find easier to associate with a written language, such as English, which is considered the universal language of software development with almost all code being written using English text. I’ll be primarily using C# and C++ through my posts but may occasionally use Python, Java, and JavaScript just to add some variety to life.

Ok, so we’ve seen some information on low-level and high-level programming languages but what exactly is involved in creating a program. Let’s take a look:

Most programming languages have a lot of similarities:

Language Component Description
Key Words Keywords can only be used for specific purposes, they are words defined as part of the language and have a special meaning. They are also called Reserved Words.
Developer Defined Identifiers These are symbolic identifiers defined by the developer of the program. 
Punctuation Punctuation is used to identify the beginning and end of statements or separate items.
Operators Operators are used to perform actions on pieces of data known as Operands
Syntax Syntax defines the rules that must be followed in order to create a program. The rules determine how the above Keywords, operators, punctuation, and developer-defined identifiers can be used. 

Simple Program: Hello World

So now we’ve got a decent overview of programs and what is involved let’s create a very simple, and pretty standard first, C# program and look at the parts.

namespace WhatIsAProgram
{
  class Program
  {
    static void Main(string[] args)
    {      
      // First assign the text we want to display to a variable
      string outputText = "Hello World";

      // Next use the language provided features to send 
      // our text to the console.
      System.Console.WriteLine(outputText);
    }
  }
}
Key Words:

We have a couple of keywords defined within this simple program including:

namespace, class, static, void, string

These words within C# have special meaning and can only use for that purpose.

namespace

Used to organise code and wraps anything within a namespace removing the risk of conflicting names.

class

Used to create a class, I’ll be putting a post out on object-oriented programming (OOP) so will cover this in more detail, but a class is a blueprint, with state and behaviour, for something we want to represent within our code. Such as a car, person, or book, take a car the state could be speed and mileage and behaviour would be Increase Speed and Increase Mileage.

static

This is a little complicated but static means we are referring to the type and not to an object we’ve created. So if we had multiple objects with a static state, each object would reference the same state. Again, once we’ve done some OOP it should be clearer.

void

We can use blocks of code to perform tasks for us in some cases the code may give us something back and in others, it won’t. Use in this context void keyword tells the program nothing is given back.

string

string is a class, notice we are using string in two places, first at line 5 then at line 8. At line 5 we are saying, this block of code will receive multiple separate strings (defined by the use of []) and in line 8 we are saying I want to create an object and it will be of type string.

Don’t worry too much if a lot of the content here is confusing, as we progress and more of the holes are filled in the concepts will begin to fall into place.
So as described the keywords above have a special meaning and we use them to get specific functionality from the C# programming language.

Developer Defined Identifiers:
This one is a little more straight forward, there are 3 (technically 4) developer defined keywords within our small program. Developer defined identifiers relate to the parts of the component the developer has control over to define the names of such as classes, methods, namespaces, and variables. We can name these almost anything we want EXCEPT for the Keywords mentioned above, the main goal, however, will be to ensure you give them meaningful names but this is a whole other topic that we will be returning to in the future.

WhatIsAProgram

This allows us a means of identifying the name given to the wrapper around our code.

Program

The name given to our class, again keep an eye out for the Object Oriented post and we’ll go into much more detail there, but the use of Program here is simply convention.

outputText

This is the name we’ve given to a variable, think of this as a container which can only hold text and we can identify that container by use of its name. We will be looking at this in more detail shortly.

Additional

Main

The text ‘Main’ identifies the name of something called a method, while method names are developer defined this is a unique case, in C# when we convert our code to be closer to low-level ( this is called ‘compiling’) and usable by the computer that process requires ‘Main’ to be available, for executables, and is used as the entry point of our program. That means every single C# program MUST have a Main method in order for the program to be compiled.

Punctuation:

Nice simple one here, punctuation is simply a means for developers to show the end of a code statement or to identify separations within a list. So in our example lines, 8 and 12 show the use of punctuation in the form of a semicolon, representing the end of those code statements. At the moment it may be confusing because as you can see not every line shows a semicolon but remember they are only used to show the end of a code statement.

Operators:

In our example we only have one operator in use:

=

This is called the assignment operator, it takes the value on the right-hand side and stores it in the left-hand side.
There are many other operators available, (Quick Note: We follow the rules of BODMAS (google for a refresher)):

*

This is called the multiplication operator, it multiplies the two values. Normally used in conjunction with the assignment operators. e.g.

int result = 3 * 4

The value of result would be 12.

/

This is called the division operator, it takes the value on the left and divides it by the value on the right. Normally used in conjunction with the assignment operator. e.g.

int result = 8 / 4

The value of result would be 2.

+

This is called the addition operator, it adds the two values. Normally used in conjunction with the assignment operator. e.g.

int result = 5 + 2

The value of result would be 7.

-

This is called the subtraction operator, it takes the value on the right and subtracts it from the value on the left. Normally used in conjunction with the assignment operator. e.g.

int result = 8 - 3

The value of result would be 5.

We’ve got many more but we’ll look at them in good time.

Syntax: 

So as mentioned the syntax is the rules we must follow in order to create a program. As with natural languages we have rules we must follow in order to create a correctly formatted sentence, the same is true for programming languages. Each programming language has its own sets of rules, much of them shared. Especially with those, I’ll be showing, C++ and C#, and as I post more hopefully these rules will become apparent. We could go through them but I think that would get tiresome quite quickly and we can learn by doing really.

So there we have it a somewhat longer overview of What a Program is than I was expecting however I think this gives us some good details to move forward with. Next up lets setup our machines so we can create some programs…

I welcome feedback, especially at this very early stage, so any improvements you think I can make please get in touch either in a comment below or send me a message and I’ll get back to you.

On the road to MCSA certification…

Been quiet recently because I took a Microsoft exam yesterday, the 483: Programming in C# exam (it went rather well) and I’ve been primarily studying for that.

Good news is I passed it so very happy with that, took me about an hour to get through all the questions which just flew by. That means I’m one exam down on my goal of getting an MCSA certification, though by passing the exam I’ve also received the ‘Microsoft Certified Professional’ certification.

Microsoft, quite nicely, has a decent path system in place and once you’ve completed an exam it shows you the certification options available to you (though I imagine anyone taking these exams will have that decided beforehand anyway). So because I’ve completed the 483 exam I can go onto do the certifications for ‘Universal Windows Platform’ or ‘Web Applications’ with the latter being my initial goal. Though I’m now thinking that as I’ve done some UWP previously, released a few apps to the Windows store (and got a few thousand downloads in total), and recently achieved my Xamarin certification I may aim for both. Mainly because my long term goal is to become very fluent in a variety of Microsoft technologies with the aspiration of getting MCSA and (additional) Xamarin certifications.

The plan now will be to apply my spare time to developing ASP.NET, UWP, and Xamarin skill sets and develop some sites and apps hopefully for clients but there are some ‘internal’ projects I want to do so looking forward to getting stuck into those.

If anyone is considering it I’d certainly suggest you give it a go, the exam was about £113 and I took out the practice test package which was very useful in giving a general idea of what to expect. Can’t really say much about the exam itself as you sign an NDA about it and best to say nothing in that respect that to tread a fine line. Though feel free to get in touch and I’ll try to give help where possible, as mentioned won’t be talking about the exam specifically though but my prep etc all good.

Just wanted to get the exam details out and to continue getting content done, I’ve got another post due out in the next few days so hopefully, that’ll be of interest.

What is Computer Software?

What is Computer Software?

We’ve had a very brief overview of Computer Hardware if you haven’t checked it out feel free to do so. I thought it would give those with a little more curiosity a starting point and is not required to move forward.

Now then, let’s check out a quick overview of Computer Software before getting stuck into checking out our first programming language.

In order to get our Computer Hardware to do anything useful we MUST have software, it is not optional. As soon as we start the computer, the software kicks in and controls the hardware. In general, we can split software into two separate categories:

    • System Software
    • Application software

System Software

The software that controls or provides access to the hardware and general operations of the computer is called the System Software and can be further broken down into 3 categories

  • Operating System

This category provides the most crucial collection of programs found on a computer. The Operating System provides many services, from controlling the operations of the Computer Hardware, spawns other programs, allows data to be saved and read, and manages connected devices. In the (distant) future I want to provide an Introduction to AOSP, this is looking at the Android Operating System and we will get ourselves a copy, build it for a commercial device, then flash our version of Android to that device, I did this in one of my jobs and it is some seriously exciting stuff.

  • Software Development Tools

This category will be very important to us as we progress, Software Development Tools provide us (Developers) with the ways we create, modify, and test our software. There is a lot for us to look into in this category and I’ll also be putting together a post on the types of IDEs (Integrated Development Environments) and text editors we can use and what languages (I personally think) are worth learning. We’ll even be learning some languages together, so I’m looking forward to getting stuck into that.

  • Utility Tools

This collection of programs are used to enhance the operation of a computer by performing very specialised tasks, this includes programs that provide data-backup and scan for viruses. There is currently no intention to delve into this area but we can see how things progress.

Application Software

I’ll keep this one short because we will be looking into it a lot but, essentially this is almost every other program you find on a computer, and importantly the same software I intend on teaching you how to develop for yourself. So this will be anything from the browser you’re using to read this, any word processing application, the previously mentioned IDEs and text editors, to computer games. This is the category of software that the vast majority of computer users spent their time using. So keep an eye out for the next post where we will look further into Programs themselves and how we can go about making our own.

This was quite a short one but it provides the information I intended and gives us some useful information moving forwards, the next stage will be looking at software and programs in more detail. Check it out here

I welcome feedback, especially at this very early stage, so any improvements you think I can make please get in touch either in a comment below or send me a message and I’ll get back to you.

What is Computer Hardware?

What is Computer Hardware?

I’ve decided to start off with a bit of an introduction into computers for complete beginners and so this will be part of that content. So let’s start with Computer Hardware – Side Note: This is likely to be the only post just about hardware, the next will look at software and continue from there.

The Computer Hardware is the name of the physical components of a computer system, these components can be placed into the following categories:

  • Input
  • Processing
    • CPU
    • Memory
      • Main Memory
      • Secondary Storage
  • Output

Input is the data we provide to the computer, this can be through a variety of means such as, using a mouse, keyboard, microphone, game controller, using touch input (smartphones), or other means including pulling data from a database (if you’re unsure what a database is you can think of it as a digital filing cabinet, we’ll look into then in the future).

The Processing is what the computer does with our data, so using the mouse from the input examples the computer would calculate where the mouse pointer should move to, what key had been pressed (if any), what effects the button press has made, or the action the must be performed on the data from the database (e.g. reading a name from the file)

The output is then the results of the performing some action on the data, again continuing with our previous examples, the mouse pointer moves to the correct location on the  screen, the pressed key is displayed (such as in a text editor), the game view changes in some way (perhaps the player jumped), or the contents of the data from the database is  printed.

In order to perform the above, a computer is made up of two very important parts, the Hardware and the Software (we’ll discuss this in another post).

Hardware

A normal computer is itself made up of several components:

  1. Central Processing Unit (CPU)
  2. Main Memory or Random Access Memory (RAM)
  3. Secondary Storage Devices (such as Hard drives)
  4. Motherboard
  5. Input peripherals and devices
  6. Output devices

The CPU

When the computer is performing a task of such as making a calculation, the CPU is actually the part of the computer that is performing this action. Therefore the CPU can be considered, quite crudely, to be the brain of the computer and the most important component.

The job of the CPU can be explained as follows:

  1. Fetch
    1. The CPU retrieves an instruction from RAM which contains the next action to perform for a program.
  2. Decode
    1. The instruction to execute has been stored in the form of a number, in order to perform its action the number must be decoded into an electrical signal
  3. Execute
    1.  The electrical signal is then passed onto the correct component to perform the operation, this could be the Arithmetic Logic Unit (performs the arithmetic computations) or the disk drive (to load some data).

** Fun Fact **: The original predecessors to modern computers where huge devices that weighed tons. They were primarily vacuum tubes and switches made up of electrical and mechanical components. Although they were extremely large by today’s standards they were not very powerful. An example can be found with

Electronic Numerical Integrator And Computer (ENIAC) was created in 1946 by John Eckert and John Mauchly and were capable of performing about 5000 addition calculations a  second vs a modern smartphone can perform billions per seconds.

RAM

While the CPU can be thought of as the ‘brain’ of the computer, the RAM (or Main Memory) is the memory (as the name suggests) of the computer. This is where active work is currently being stored, for example, any executing (running) program will be held in RAM, this includes any data the program is working with. RAM is also very quick, this is a huge benefit and along with many other improvements is very noticeable by how fast modern PCs run.

RAM is a volatile memory type, that means it does not continue to store its data once the computer is turned off. This is unlike Secondary memory or secondary storage, described later.

Interestingly, it is called Random Access Memory because it enables the CPU to quickly access the data stored at any random location, hence the Random Access name.

RAM is divided into small storage locations called bytes, a single byte is large enough to contain a small number or character. Modern RAM “Sticks”, a stick is just one RAM module, work in the billions of bytes. For example, a standard 4GB stick is 4294967296 bytes, huge right? Of course, this is again another example of great improvements in the world.

Each byte can be further divided into small storage items called bits (binary digit), there are 8 bits to a byte. A bit can be thought of as a tiny switch (much like your light switch) and so can be in one of two positions, on and off. In modern computers however they are not actual switches (at least not like your light switch but the understanding is easily transferable). So a bit can be thought of as being on or off or being one of two values a 0 or a 1, which is called binary. Bytes have their own unique address and is identified by that address, in a similar way postal addresses work.

Secondary Storage

Secondary storage is non-volatile memory, this means that the data stored on the disk continues even after the machine has been turned off. Programs that we install on our computers are stored in secondary storage, such as text editors, browsers, streaming services, and the apps we install. It is quite a bit slower than RAM but still very quick in its own right.

There are a few common secondary storage devices, Hard Disk Drives (HDDs), Solid State Drives (SSDs), Compact Disks (CDs), Universal Serial Bus (USB) drive, and many others.

  • HDD:  Works by storing data magnetically onto a disk.
  • SSD: Uses semi-conductor chips, for those of you who are keen on RAM chips the SSD chips are non-volatile and the data stays put without power.
  • CD:  Stores data in microscopic holes called ‘pits’ and ‘lands’, these pits and lands are read using a laser and are turned into an electrical pulse which is recognised as 0s and 1s
  • USB Drive:  Also uses chips to store data. These are small and very cheap.
  • Additional
    • External HDD: The same as HDD except these devices are connected, normally through USB, to the “outside” of the computer and can be moved between different  computers quite easily

Input Devices

In order for a computer to be able to do anything useful we must provide it with input, how this input is provided varies wildly, from using a mouse or keyboard or input from a database or a file on the computer.

Essentially any device that collects information from the ‘outside’ world and provides it to the computer is considered an input device. As mentioned, a mouse or keyboard are perfect examples but also consider the USB drive that provides us with data stored on it. Additionally, temperature reading devices or the components in modern phones such as accelerometers and gyroscopes are input devices.

Output Devices

As the name suggests output is any information provided by the computer to the outside world can be considered output, printed documents, Graphical User Interface (GUI) on a monitor, flashing LED, audio through speakers or headphones, cooling fan, data saved to external memory such as external HDD, USB devices, and CDs.

Conclusion

Hopefully, this hasn’t been too much information for you and you get the general idea of what a computer is and what each part of the computer does. Not all parts mentioned here are needed and there are some parts left off but this gives you a good starting point. I won’t concentrate too much on Hardware specifically but wanted to give an overview before I got into the areas I’m more interested in, which is Software and the next post is coming soon…

I welcome feedback, especially at this very early stage, so any improvements you think I can make please get in touch either in a comment below or send me a message and I’ll get back to you.

Now with Xamarin Certification

So just wanted to write a post as I just got my Xamarin Certified Mobile Professional certification today, very happy with that.


Very Quick Overview of Xamarin:

Xamarin is a cross-platform mobile development framework for developing Android and iOS apps. It allows a huge amount of code reuse through the use of the Xamarin.Forms framework and when coupled with UWP allows for all 3 major platforms to have an app developed at a huge reduction in cost, time, and effect (the magic 3 in my mind). The best bit is that it is all done using C# (and XAML if you want) and makes use of native APIs for those platforms. Xamarin tries to provide a wrapper that you use to do what you want but the underlying framework calls into the platform-specific APIs, obviously this doesn’t work in all cases but they recommend you can get anywhere from 70-90% code reuse.


I’ve been using Xamarin (not as part of my day-to-day job) for quite some time, about 2 years on and off I think. My goal has always been that I will move into mobile development (…again (my first job was as the Android developer within an R&D team)) and for quite a while I only had the time to do any mobile development in my spare time, which there was not a lot of and even less now. But to be honest it’s more than likely I didn’t make as much time as I could’ve to speed the process up… the lies we tell ourselves hey.

My introduction with mobile development was through Android (day to day job back in 2014/2015) and I had a Windows Phone for a few years so I made some apps for that and put them up on the Windows Store. Though nothing to shout about tbh, for example, the first was the classic Torch app, though one I was quite happy with was a Pokemon guessing game where users would guess the name of the Pokemon back on the silhouette (basically the “Who’s that Pokemon” game in the show). A few people seemed to like it, wouldn’t go looking for it though in case you were interested it’s not available in any of the stores. No doubt there are plenty of good alternatives, I even contacted the Pokemon Company the find out if I could somehow develop the game properly…. as you can imagine they were not interested.

Anyway coming back to Xamarin, when I heard about it I thought it was brilliant, started listening to the Xamarin Podcast, with James Montemagno and Pierce Boggan (check it out here), and attended one of the Xamarin Dev Days (which was really good and even got to have a go on the Hololens which was cool) though they don’t seem to be happening anymore. As mentioned becoming a mobile developer, specifically a Xamarin developer, has been in the works for a while now and I didn’t seem to be making much in the way of progress (always something taking up the time, I’m sure you’ve experienced similar problems right?) but a few months ago I just decided I was going to go for the certification and I would get it. After some time and effort, today is that day, if you are thinking about doing it yourself I highly recommend just starting the material on the Xamarin University website. Get through it as and when you can and before you know it you’ll be making a nice amount of progress. Even if you don’t want the get certified still worth a look, the content is free.

I’ll be releasing some material over the next few months about how to get started and possibly some other tutorials. I do have some other Introductory content coming up but I’m looking to target that in a more general sense using C++ and C#. Should hopefully get the ball rolling soon.

Thanks for reading and if you have any comments feel free to leave them or send me an email via the contact page.

The First Post

So this is the first post. I’ll try to keep it short and simple.

I’ve been wanting to do this for quite some time and it’s, as with many things in life, one of those things you decide to put off and say “I’ll do it tomorrow” or “I’ll do it when I have time”. So I thought I’ll just go for it and see what happens…

I’d think the best way to start will be to describe myself, Aaron Waddingham, and what the plans are for this site.

Well, I’m a Computer Scientist (by education) and currently working as a Software contractor which I have been doing for just over 12 months. My own introduction to Software Development was through an academic environment specifically the University of Glamorgan, now called the University of South Wales. I studied two qualifications at the university the first was an HND in Computing as I had almost zero software experience up to that point and the second was a BSc(Hons) in Computer Science and graduated in 2014 with a First. From there I moved into my first Software Development role with General Dynamics and during the time I was there I worked on 4 different projects. During the middle of 2017, I decided to move into contracting and made the move in August of that year with my first contract being with MBDA. I won’t go into any details on what I have been doing on those projects as I plan to add a “Projects/CV” section to the site in the future.

So moving on, as mentioned I’ve been planning on starting a website so I can begin sharing my knowledge and experience with a wider audience as well as provide potential clients with a glimpse of the skills I can bring to the table.

Thanks for reading all the way through the FIRST post and let’s get going…