Home About

Choosing You First Programming Language

Welcome to Choosing Your First Programming Language, volume 23,097!

A joke, of course. There are an abundance of articles out there about choosing your first programming language. So, what makes this different? Hopefully I can provide an unique perspective that alleviates the questions and indecision that so many face when starting out.

The Cold, Hard Truth

There is no best language. There is no wrong language. The only consideration when choosing a language to learn is what do you want to accomplish? The question should not be "What programming language is the best to learn?" but "What programming language is the best to help me accomplish my goals?" What do YOU want to learn? What do YOU want to accomplish? If your goal is to just get a job as a developer, you can learn the language that shows up most frequently in your job search. The problem I can see with that, is you have to be excited about the stack you're working with. If you want to automate something at work, VBScript, PowerShell, or Python might be better suited for you over Java or C++. If you want to build a website, JavaScript or Python is the way to go over C or C#. If you want to learn Computer Science or Computer Engineering, then something with memory management and other low level controls is best.

Perfect Practice Makes Perfect Software

Practice, practice, practice. Practicing 20 minutes a day 7 days a week is better than 2 hours 1 day a week. Ideally, you want to improve on something every day. Something to consider is learn something new every day. If you can't learn something that day, teach something. You may teach yourself something new while teaching others. Document your discoveries or share a cool thing you learned in the book you're reading. Athletes don't become champions or record breakers overnight, in a month, or a year. The same can be said with musicians, composers, and rock stars. Expect the work you put into learning and mastering software development to be what you get out of it.

Pick One and Move On

P.O.M.O. can be applied to many things. This includes learning to write software and deciding which language to use. Once you make a decision, fight off buyer's remorse. If you're in school studying Computer Science or Software Engineering, the decision part is easy because it's made for you. The professor will likely choose C++, Java, or Python as your introductory level language. You'll eventually move into Java or C++ for Object Oriented Programming, and if you explore Programming Languages as a field of study or higher level course, you'll probably run into Assembly, JavaScript, Haskell, C, and tons of others.

Carving your own path is a bit more difficult, whether you're learning to change careers or find a new hobby, but you are given a little more flexibility. The important thing to do is once you pick your language, master it. Resist flipping between two or three languages at a time. It will stint learning and delay progress. Once you understand computer logic and the syntax that you're writing programs and tools that suit your needs, learning another language or three will come more easily and you'll be able to directly apply concepts to a new language that solidify that understanding.

Knowing What I Know Now

If I could do it all over again, I would have gone with another language over C++ as my first language. I learned a lot, and I am deeply appreciative of my professors from my early Computer Science studies. However, I think there are other system level languages that are more accessible for students over C++.

Contenders

Python

I have a love/hate relationship with Python. However, it's difficult to argue against choosing Python as your first programming language. Python uses very strict rules that force strict utilization of whitespace, spaces, punctuation, and declarations. This helps budding programmers learn formatting, styling, and a strongly typed language.

A strongly typed programming language is beneficial as it teaches making data types compatible with each other. While you don't have to declare the data type of a variable in Python, you do have to make sure the data is compatible before doing any arithmetic or concatenation. This introduces the programmer to thinking about their data before runtime happens, and influences writing better software (ideally).

Some great resources for learning Python are Learn Python3 the Hard Way, Python Programming: An Introduction to Computer Science, and Python Crash Course.

Many Linux components are running Python and a lot of tools in the Information Security realm are in Python as well. If you want to build a website, you have Django and Flask to provide a framework to work within and accelerate your development process. It is a language worth learning, at least to gain familiarity with. It serves as a great introduction to computer programming.

C

The C programming language is the beacon of inspiration for most modern computing constructs today. Windows? Yup. The Linux Kernel? You betcha. That interpreter that runs Python? You guessed it :D All written in C. Well, C and other things. But mostly C! C is an easy language to learn but difficult to master. I've started learning C the hard way to get a better grasp on Unix programming, and it is a hearty task! You have all of the freedom with little restriction, which can present some undesirable or nasty effects at compile time. With a little practice, though, you can truly do anything in C. One can build game engines, operating systems, web servers, and networks.

C is a hard introduction. Despite the titles of some books, you will not learn it in 24 hours. With C you will get an incredible base to springboard into other languages that were influenced by C. You will also be able to build your own language with C!

The language has been around for a long time, so there are a lot of strong opinions on how to use it. There is also a diverse community surrounding the language. That comes as a pro and con, so think twice about which community you go to. I would avoid asking questions on StackOverflow and use something like cboard.cprogramming.com -- StackOverflow often comes with some dialog that is discouraging to a new programmer.

Something to note, You will be told to read this book:

I do not recommend the book for beginners. K & R wrote the book with a lot of presumptions. They leave out a lot that a new, modern developer will need to know. Personally, I feel like their ego got in the way of teaching. It makes a great second or third book on C, but as a beginner, I do not recommend it.

If you choose to pursue C as your first language, you will have a tougher time than choosing something like JavaScript or Python. However, you will have a stronger foundation and be more equipped to handle those languages and more throughout your future and career.

Some great resources on learning C are C Programming: Absolute Beginners Guide and Learn C. You can also use Zed Shaw's book, Learn C the Hard Way (linked above).

Rust

Rust is a newer language that emerged in 2010. It has excellent built in features like memory protection and thread safety, which prevents unexpected and potentially disastrous results. There are numerous languages that went into influencing Rust, and it shows by having a wide set of capabilities. Rust has become popular with operating system developers, reverse engineers, and hackers of all sorts. I first learned about it from the OS-Dev wiki site, and began exploring the language. I put it off, because it looked like what Go offered, which I was (am) learning about. However, getting deeper into systems engineering, I decided to revisit the language. It has been a pleasure to work with, so far, and I'm surprised it is still under the radar as far as people talking about it.

Personally, this is the language I would have chosen to start with doing it all over. Rust allows system level programming like that of C or C++, and has an awesome package management tool called Cargo that helps with packing, building, and shipping software. There is also a ton of support for expanding on this with cargo-docker and cargo-build-deps, two packages that ease the process when deploying with Docker.

Their e-book lives free on their documentation site. If you want a physical copy, you can check it out on Amazon or No Starch Press.

If you want to get into embedded systems, networking, operating system development, or just want to be part of a great community that welcomes developers from all areas of the Internet, check out Rust. Seriously, the first book I've read that goes over doing something in Unix, Linux, Command Prompt, AND PowerShell. Most books have a Windows section that glosses over installation or says "Go figure it out". While I'm not doing Rust programming on Windows, I appreciated their open arms and attention to detail (PowerShell is not CMD).

Golang

Golang, or Go for short, is Google's open source programming language. It has excellent documentation, including A Tour of Go which provides an interactive tutorial of the language. There are also best practices, stylistically, and the source code for the project. What makes Go so special?

Their standard library comes with (mostly) everything out of the box. Networking, web server, graphics, processing, etc. It can serve as a foundation for a great, monolithic application, or as a simple script to check on running processes and report back. Go is flexible, fast, small (doing a lot with a little), and compiles down to a single binary. Go offers type-safe memory handling, with a package (aptly named "unsafe") that you can import to get around this for low level programming and systems engineering.

Go is strict in the sense that formatting matters, but still allows the programmer to decide their method (or function ;) ) of writing software. There is a built in tool called gofmt that allows one to check the style of their code compared to the Golang standards. This not only improves readability of Go, but provides a unified method of writing Go that leaves little room for error.

Had Rust not existed in the time machine that I decided to use to go back and learn programming, Go would have been my language of choice. There is a $GOPATH environment variable and series of tools provided with go that make developing with the language, whether it's software or tools, a joy to work with. go install, with a properly configured $GOPATH, adds the compiled software directly to your $PATH and makes it immediately available after compilation.

go install $GOPATH/awesome/software allows for the software command to be called at any time, anywhere in the system.

[chris@battlestation]$ software run will start the program, if "run" is a valid argument.

Definitely check out Go if you're interested in system programming that allows for flexibility and contained packaging. The Go Programming Language makes a great, yet difficult introduction. Work through the book, feel free to skip the exercises if you don't understand them, but be sure to revisit when you've gained competency. The Tour of Go should help quite a bit as well.

Honorable Mentions

One cannot simply describe "Programming for Beginners" without including JavaScript. A great deal of people get into software development to build their own web sites or become web developers professionally. JavaScript is accessible and safe enough that the mistakes and errors don't matter. Chrome and Firefox come with great tools to assist with debugging and development of JavaScript, which means it's literally everywhere. The use of the var keyword and loosely interpreted types allow a beginner to focus on the logic of programming over the syntax and other nuances.

C#, Microsoft's Java, surpassed Java many years ago. While Java has been steadily catching up, especially with JDK 10, C# is a fantastic language to learn if you're developing for Windows, making games with Unity or Unreal Engine, want a great dancing partner for MS SQL Server, or want a solid backend for web development on IIS. With the advent of .NET Core, C# is now a more capable cross platform language that can be developed, compiled, and ran on OS X, Linux, and Windows.

I hope you enjoyed living vicariously through my regrets and interests. Maybe this will help you the way it could have helped me in 2012! Hopefully you've found this beneficial, entertaining, or at least readable. Definitely let me know!

comments powered by Disqus