Programming Languages: Picking the one right for you

code, coding, computer

One of the biggest questions for an absolute beginner may be pertaining to languages – which do I choose? There are a number of aspects that one should consider, to begin with.

What is it you hope to do?

It is important to have an intention or goal in mind before committing to any language and to acknowledge this. There is a multitude of choices out there for every job role, but some are more suited than others. One must consider the employability that learning the language provides since some are viewed more highly than others. Remember, popularity doesn’t mean quality.

Java, the most widely known and used programming language, is also one of the worst you could start off with (in my opinion). While it can be used for software and game development alike, there are languages equivalent to this which will allow you to achieve greater heights in the long-term.

The direct alternative or comparison that many make to Java is C++. Both are Object-Oriented (find more info on this here), have multiple uses, yet C++ is not only more efficient with memory but is more relevant today. I must admit, this has turned into a somewhat one-sided rant against Java – so I digress.

What is the learning curve?

Programming languages differ in the length of time and dedication they require one to put in. There are a number of reasons for this. First of all, there is the size difference. C++, for example, is substantially larger than C# and thus will require greater perseverance. Second, there is the syntax. The syntax is essentially the group of rules for the code which is written – much like the grammar that defines the way we speak the English language.

To demonstrate this, I should compare C++ and Python – and yes, I know, I like C++ a lot. Python, a scripting language to be precise, does not use semi-colons or curly-braces. On the other hand, C++ sticks to this strictly and will throw up alarming errors if the syntax is not followed. This may deter you or attract you – it’s up to you.

The final attribute that can aid in a language’s difficulty is the documentation or the lack of it. Not every language is particularly well-known or widespread, although Java and C++ are. For example, fewer people use Lua or Bash so there will be less help available. Video tutorials and documentation is essential when learning a language, particularly since books can be pricey.

Where do you want to go afterward?

This is a point I have already touched upon, but I want to highlight the importance of it. The first language one learns can determine their path from then on, whether it be success or failure. In the worst case scenario, one could start learning Java only to give up after encountering the steep learning curve. Alternatively, a new programmer may attempt to learn Lua, to begin with, and be unprepared for the (scary) world of C++ later on. I am most certainly not condemning Lua or any other language for that matter. However, the first language you choose to learn could be considered the step into the programming world, while the second step may be defined by the first. Therefore, the first language should ideally prepare you for the next one, since being multi-talented is a good trait for a programmer to have.

What do I recommend?

There are various programming languages that are good starting points, for one with no experience of code whatsoever. The reason I’m using C# in this series of blog posts is due to its flexibility and the preparation it gives for C++ at a later point. Below, I have compiled a top three list of languages for various areas that you may be interested in, along with reliable websites for more information:

Software Development:

Game Development:

Web Development:

This is by no means a definitive list, but simply to get you started. If you wish to know more about any specific language in this list, feel free to consult me below. I am less experienced in web-based programming, but I have dabbled in it prior to now. Until next time!

 

 

 

 

Programming Fundamentals [1]: Visual Studio, Variables and Data types

Welcome to the first post on Programming Fundamentals! If you haven’t set up Visual Studio, check out this previous blog post.

Creating the project

First of all, let’s set up a new project to work in. One way to do this is to select the File dropdown, New, and Project. As you can see, the shortcut Ctrl + Shift + N will also work in the future.

 

SS_1.PNG
Creating a new project

 

Once selected, an additional window will appear with numerous options. The left-hand side shows the various languages that are installed, while the middle section displays the various application types. The right-hand side meanwhile gives further information on the select option.

For the purpose of this post, let’s select ‘Visual C#’ on the left, and ‘Console App (.NET Framework)’ in the middle. Finally, we need to name the project below this – please note, there is a project name and a solution name. Visual Studio will automatically allocate the solution name as the project name, so we needn’t worry about that for the moment.

I will rename my project ‘Programming Fundamentals 01’ and then select ‘OK’.

 

SS_2.PNG
Setting up the project

 

Variables

You will notice immediately the sheer amount of code already in the project file. Essentially, everything we will write in this blog will be inside the following:

SS_3.PNG

I will expand on what it all means at a later point.

Variables are one of the key building blocks of a program, allowing the programmer to store information for later use. Any data that needs to be reused, such as user input, will need to be stored in variables. The key thing to remember here is that the value of variables can be changed – they are not immutable, and are often temporary.

Variables are declared with a structure similar to the following:

<Data Type> Name = Value

A variable has to be declared before it is used – a declaration must have a type and a name, but a value doesn’t need to be immediately specified.

Data Types

Data types are what essentially defines the type of value a variable can hold. These correspond to what we use in maths, more often than not.

Here is a list of the most common ones:

int – Any whole number (25)

float – Any number with a decimal place (25.0f)

bool – A value of true or false (true)

string – A collection of characters (“String”)

char – A single character (‘c’)

Implementing a variable with a data type

It is fundamentally important to assign the right value that works in accordance with the type of the variable. Failing to do so will result in an error, and the program will not run.

Consider the following:

SS_4.PNG

This is a correct declaration for a variable, of type int. Conversely, if we do not initialize it correctly:

SS_5.PNG

This happens. The name and value are underlined in red, indicating that the variable cannot hold this value. An error would occur if we tried to run a program with this since the syntax is at fault.

Now, it is your turn. I have demonstrated the basics of variable creating, try creating one of a different type and value. Remember, keep it within the static void Main() section.

Your variable/s should be something like this:

SS_6.PNG

Assigning variables

Lastly, before I conclude this post, I wish to touch upon assignment. A variable can either be assigned upon declaration or later on. This is done through the ‘=’ operator – I will talk more about operators in another post. Since a variable represents a value of a specific type, if another variable shares the same type, it could be assigned to the first, opening up many possibilities.

If you have any questions regarding this topic, feel free to grill me in the comments below. With that said, au revoir!

 

Setting up your IDE (Visual Studio)

Before we start on the juicy bits of programming in a later post, we should first set up the software that enables us to code. Visual Studio is widely used on the Windows platform for software development and game development, which makes it the ideal IDE (Integrated Development Environment) to use.

In the soon-to-come Programming Fundamentals posts, we will explore Visual Studio Console applications. However, once such foundations have been established, it can be used for much more.

First of all, let’s locate the website for Visual Studio – simply ‘www.visualstudio.com’.  There are four options displayed on the page; the one on the furthest left, Visual Studio IDE is the one we need. There are three versions of Visual Studio: Community, Professional, and Enterprise. The Community edition is free, with all the features we need to get started with. Let the download commence!

SS_1.PNG
Three versions of Visual Studio – select Community

After a little bit of processing and extraction, a little window will appear like this:

SS_2.PNG
Visual Studio terms and agreements

You can simply click continue, and accept the terms – they are nothing special.

The next window is an important one, detailing the features that we would like installed. This is essentially the configuration of the features we will use. While additional features can be added later on, it is easier to add what we need to begin with. This is largely up to you, but there are some default options that I would strongly recommend including:

SS_3.PNG
The base features you will need for Visual Studio

The three of these allow for us to use a range of programming languages: C#, C++, Visual Basic and more. We also gain access to various application types that will become handy later on.

To finalize the process, simply click Install – then wait for it to set the environment up for you. The IDE will ask for an account to log in, which can be a Google account or a new one.

SS_4.PNG
Visual Studio, with the installation complete

Once installed, Visual Studio may greet you with a sight similar to the above. This is the main page, displaying recent projects and various other options – ignore them for now.

Before using Visual Studio, we should first familiarise ourselves with Solutions, Projects, and Files.

Whenever you create a new project, a solution will be created along with it. Projects essentially belong to a solution, and therefore a single solution can have different projects. Files are contained in projects, acting as the content. A file is created by default for us to write code in.

You can think of those three in a hierarchical way: Solutions > Projects > Files.

With that said, Visual Studio should now be set up, and working correctly. The next post will introduce how we create projects in Visual Studio, the idea of variables and the various data types that exist within programming. Until next time.

Coding – what is it, and where do I start?

developer-coding-in-php_925x.jpg

In this first blog post, I wish to address a few important fundamentals when it comes to programming before we dive into the substance.

Coding, or programming as its otherwise known, is the idea of writing a set of instructions for a computer to follow – this may be to fulfill a specific task. However, this is where an issue occurs: computers don’t speak English, so how do we do this? Since computers operate in binary, 1s and 0s, any instructions that are given by the programmer must be converted into it, particularly since we humans are unable to understand binary effectively in the context of a fully-fledged program.

Programming languages are designed to be comprehensible to humans, while also translatable to binary. This translation is done automatically, so our brains don’t have to worry about it.

The important thing to remember is that there are different levels of languages: high level and low level. Higher level languages are closer to what we understand, while lower level languages are more easily understandable for computers – binary is one of the latter. Further up from binary, we have assembly languages, which operate through keywords to store and allocate data. On the highest level, we have the languages that are used commonly: C++, Java and such. These are what programmers use to develop applications of various kinds, high-level languages.

There are a vast array of languages, with different intricacies. However, don’t run away yet. It is an exciting world full of possibilities hidden below the surface.

Now, where to start? I would say, learning the fundamentals of programming. While the idea of developing an amazingly advanced game or a complex piece of software may be appealing, one must first gain an understanding of the foundations.

However, what can you do with programming? Below is a list of the numerous possibilities and languages:

  • Game Development – C++, C#, Java
  • Web Development – CSS, HTML, JavaScript
  • Software Development – C++, C#, VB.NET

 

After selecting a language, you need a piece of software to facilitate your ability to write code. In other words, an Integrated Development Environment (IDE). This gives the programmer all of the tools they need to write code, including a lot of helpful ones. There are many IDEs available, varying depending on your Operating System, but some of the best ones include:

Since I use a Windows PC, I shall be using Visual Studio throughout the entirety of these blog posts. The next post will talk in depth about how to setup Visual Studio, and configure it to your liking. Until next time!