If you’re entirely new to programming, this post will help you get set up to do your first project. We won’t do any coding just yet; for one thing, we have no way to turn the code we write into an actual program. To perform this process, we need a tool called a compiler. Compiling is a term that defines the process of transforming human-readable code from a language like C# (read as C Sharp) into machine usable code. If you’ve ever heard of the terms “binary code” or “machine code” or even “assembly language”, these are the low level instructions that the physical hardware of your computer understands. You could write programs in those languages, but frankly, it is a very slow process at best, and most of the time, there is no need to use a language so granular as that.
What is C#?
C# is a programming language that follows a general series of structural rules and approaches that make up what is known as the C family of languages. These languages include: C, Objective C, C Sharp and C++. The structure of the code written in these languages (referred to as their syntax) is relatively similar, but while some (C Sharp and Objective C) are relatively easy to use, others (C and C++) are far more elaborate. The complex languages are commonly used for building the operating software of your computer (Windows, Mac OS, etc), advanced video game development, and especially intensive mathematical or scientific programming.
There are a lot of other languages that also share the style and format common to the C languages, so once you’ve started using this format, it becomes much easier to start learning the other languages.
Why are there so many other languages if they all work in such a similar fashion? In addition to the uses I mentioned above, some of the languages are specific to working on certain platforms (Windows, MacOS, iOS, Android, etc) and some of them are meant for uses for specific types of development (desktop applications, websites, mobile device applications, and more). As a result, different languages evolved to specifically handle those various needs.
Think of it this way: why are there so many different types of road vehicles? Cars, pickup trucks, tractor trailers, tanker trucks, fire trucks… each of these vehicles serves a different purpose; they are used for personal transportation, moving heavy loads, or carrying the equipment to handle emergencies. I doubt very much that you’d want to try to plow snow in a place like Buffalo, NY or Denver, CO with a small sports car with a giant plow mounted on it. By the same token, you aren’t going to be taking a person who was in an serious accident to a hospital using your motorcycle.
Setting up an IDE
While it is possible to write the code for most languages in a simple tool like Notepad or another simple text editor, the fact is that you’d need another set of tools to actually perform the steps for compiling that code into an application; and the process can be lengthy, to the point that it can be a nightmare to manage.
It can be done that way, but it’s a painful process. Fortunately, there is a much easier alternative; the IDE – Integrated Development Environment. An IDE is a program that is generally graphical in nature that allows you to write your code, correct syntax errors (like spell check in a word processor), and test and fix logic (debugging). An IDE will almost always come with a compiler (or will help you to set up an external compiler program) that will then take your code and perform the necessary transformation into an actual program. In more advanced IDEs, they may have built-in tools to help you optimize your program, connect to other systems for more extensive development, and provide many more features to make advanced development much easier to handle. One of the best features of an IDE is that they usually perform things like syntax highlighting and color coding – they will actually display the language with colors to help denote what you’re seeing, which makes it easier to tell if you’ve made a mistake.
There are many IDEs on the market today. Some can be VERY expensive, and others are free. In some cases, like the one we’ll use, there is a free edition and more advanced professional versions you can upgrade to if you need the advanced functionality. Chances are, if you’re working through this material, you’re not a professional, so the free edition is all you need. In that case, you can use the tool I’m introducing here.
Microsoft Visual Studio Community Edition
Microsoft released Visual Studio was first introduced in 1997, and supported several languages. At the time, there were only professional or enterprise versions of the software. Since then, Microsoft has released many updates and new versions to the software. As of now (February 2020) the most recent stable build is Visual Studio 2019.
One of the great things about Visual Studio is that there are versions for all of the major computer platforms, so you can technically develop along the same vein if you’re an Apple user instead of a Windows person. There is a catch, however. You are limited to the types of projects you can do outside of Windows. Simply put, the graphical applications you use on a Mac require libraries and functionality that is different from Windows, so if you want to write applications for Apple machines, you’ll need to do a bit more.
Getting Up and Running
For now, I am going to run with the assumption that you’re a Windows user. Keep in mind, if you have a relatively modern Mac, there are options to set up Windows on the machine. One approach is to use a Virtual Machine. This is a program that lets you create a “virtual” computer that resides on your physical machine. In essence, you simulate having a computer with it’s own disk space, memory, programs, etc. That machine can be turned on and off at will and can be set up with any number of different operating systems and virtual hardware configurations. The best part about a virtual machine is if you royally screw up, you can delete the copy of the system and build a new copy. That approach to doing all this is beyond the scope of this article, but you can easily find a TON of information on the topic by going through you’re preferred search engine and looking for the term Windows virtual machine on MacOS, or Linux, or whatever you may be using.
But assuming that you are either on a Windows machine or at least a virtual machine, we can get ourselves started. Go to your preferred search engine and look for “microsoft visual studio community edition” or you can go directly to https://visualstudio.microsoft.com/downloads/.
Select the option to download Visual Studio Community edition. The file that downloads will help you set up the program, so once it finishes downloading, open it and you’ll get a screen that contains a list of options.
It will then be replaced with the following:
These are the general groups of components you can install. If you have the room, you can feel free to install the whole package, but that’ll take up a SIGNIFICANT amount of space on your hard drive, so check to make sure you have the space to do that. As you click on options, a small label at the bottom of this screen will tell you how much space is required. If you check against your C drive, you’ll see how much you have available.
Start by selecting .NET desktop development, Universal Windows Platform Development, Data storage and processing, and .NET Core cross-platform development. Then, up near the top, you’ll see “Individual Components”. Click this and you’ll get a VERY long list of individual features.
Make sure to check all of the options in the images above. There are actually more options beyond that third image, but we don’t need to concern ourselves with that for now. In the lower right-hand corner of the window is a drop-down box that will default to Install while downloading; the other options is Download all, then install. In theory, if you have a slower machine / connection, the second option is better, because it won’t slow down the overall function of your machine trying to do both at the same time. Now, just click the “Install” button to the right and the process will start running.
This will take a while, especially depending on your connection and computer. I hope you’re not still on a dial-up connection. There’s a LOT there to download and you’ll be at it all day. If you’re on a better connection though, the typical install time is somewhere between 5 minutes and half-an-hour. You can do something else in the meantime; maybe read and try my article on baking a loaf of bread; or if you do have that slow connection, consider something that’ll take a bit more time… like learning to play the violin flawlessly, or drafting a workable peace plan for the entire world. OK, I’m just kidding, those things aren’t nearly as slow-moving as a dial-up internet connection.
Wait, what if I need something else?
The nice thing about the setup for Visual Studio is that you can always add on functionality later on if you need some additional tools or libraries. If you used the pictures above as a guide, though, that’s it! You’re ready to go.
If you’re disappointed that you didn’t actually write a program, don’t be! You can’t learn to write software if you don’t have the tools to do it properly; and you want to learn to do this properly, so one thing at a time. In my next article, I’ll give an overview of the program we just installed; then we’ll make a simple console app. It won’t do much, but it’ll hopefully start you on the path to having a neat hobby and some useful skills.