Today's post is a small go-to guide for beginner programmers in Null Byte. With many of our community members picking up programming from our Community Bytes, it only makes sense to lay out a one-stop guide for your reference. Hopefully this guide will help you make an educated and thoughtful choice on what programming languages you want to learn, and how you want to learn said languages.
The question has come up in the forums already. What programming languages should I learn? Well, a good friend of Null Byte once said that a programmer should learn a compiled language, an interpreted or high-level language, a scripting language, and machine code.
If you are very new to all of this, I bet you're asking, "What do these types of languages even mean and why should I learn so many?". To answer that, I'll need to explain what each kind of language really is, and list examples of each. From there, I will guide you to great resources to learn the languages that pique your interest.
Hacking and programming are nearly one in the same. Don't get me wrong, there is a lot more to hacking than just code. However, when you learn how to code, you are taking the computer and making it do what you want. You are learning what makes it tick. Only then, when you understand how things work, you will have found that you have already become a hacker.
Note: If you need to make a programming environment for yourself, check out this great guide from Null Byte.
The mother of computer languages, binary is as simple as it gets (in terms of logic, not actual simplicity). The 1's and 0's that make up binary represent a boolean integer for on and off. These are grouped into octets called bytes. Each byte can be up to 256 different combinations (0-255). These are assigned registers and values, and are interpreted by computer programs.
- Here is a simple binary tutorial. It will provide all you need to understand the basics. It's far simpler than you may think.
Machine code (or assembly) is code that speaks directly to the hardware. Each processor type has an instruction set that it uses to understand commands given to it. This results in code that can be executed with nearly 0 latenecy. Programs execute as fast as your processor capabilities allow when you program machine code using assembly.
Machine Code Resources
- A great book to read, especially if you are new to programming and assembly, is Programming from the Ground Up. This book will help you understand how computers work, as well as their processors. Then it takes you into coding in ASM assembly.
Compiled languages are languages that are written in a code syntax, such as C/C++. They are run through a compiler, which turns them into machine code executables. This may make you wonder why we even use assembly. Well, an elite hacker who is a mentor of mine has always taught me that the compiler takes shortcuts—and for perfect, fast, clean code, you must code it yourself and "outsmart" the compiler.
Considered a mid-level languate, C/C++ is probably the most popular programming language and usually the most favored among skilled coders. It is very fast, but can be hard to understand. You probably shouldn't start with this.
- A great beginner book that is up-to-date is C Programming: A Modern Approach - Second Edition.
- Also, commonly considered to be one of the greatest programming books ever written, check out The C Programming Language. It was written by the creator of the C programming language (RIP, Dennis Ritchie).
- Videos from LearnToProgramDotTV.
Haskell is strange, but the people who learn it tend to be very amazing programmers. It is a purely functional language, which means that in general, functions in Haskell do not have side effects. There is a distinct type for representing side effects, orthogonal to the type of functions. A pure function may return a side effect, which is subsequently executed, modeling the impure functions of other languages.
- There is a beautiful answer on this Stack overflow page on how to go about learning Haskell.
Java is a great language. Comparable in ways to C/C++, Java uses its own interpreter and compiler that runs across all operating systems to execute its byte code. This mean it is completely portable. Java is also a very fast and lower-level language, so it's great to have in your arsenal. Many jobs hire programmers with experience in Java.
Interpreted languages are languages that are commonly scripted and then run through an interpreter. The interpreter processes the script as machine code. This allows code to be short and elegant, but takes up a lot more precious resources.
My personal favorite, Python is a fast, simple, clean and user-friendly programming language that focuses on user readability. This makes learning Python easy and very fun.
- How to Think Like a Computer Scientist, Python is a great book to get started in Python. It gives you analytical tips on tackling tough programming problems. Even a little bit of artificial intelligence is taught at the end where you make a program that actually learns!
- TheNewBoston has tons of great vTutorials that will walk you through learning Python.
- Learning Python takes you from the beginning of learning Python, to the elite. It is a very long, but complete book to becoming a sage with Python.
- DiveIntoPython is a pre-exposed programmers tutorial for Python. If you can trudge through it and understand it as a beginner, this is by far the best way to learn the language. The book teaches perfect coding habits and syntax, right up-to-par with the Python standards.
Perl is similar to Python in many ways. Its syntax is slighty more difficult, and it is less powerful than Python in some areas. For that, I reccommend only learning it to read and hack other coders' Perl scripts.
- The Perl website has a free book and loads of other resources right there, which also happen to be some of the best.
- Learning Perl is an extensive book and Perl's counterpart to its Learning Python cousin.
PHP is an important language on the internet. Nearly every website uses this language to perform scripted tasks, such as parsing information from a database. It can also be used to code fun things like IRC bots! Learning PHP is essential to learn if you want to be a hacker, because most websites on the internet use PHP, and to exploit it, we must learn it.
- The official PHP documentation is the best place to learn PHP, in my opinion. Learning from something like the PHP bible can be far too overwhelming, and a lot of the information provided could be irrelevant to beginners, or make little to no sense.
Learn BASH/ plain and simple. Windows users rarely need to use the terminal. However, Mac and Linux users can benefit on a large scale if we all got together and learned the terminal. This can make repetitive takes a cinch with a script! If you have a webhost, it is likely they will run Linux, so why not make your life easier and just learn it now?
- The best guide to BASH and just managing your computer from the terminal would probably have to be The Rute User Tutorial. I really can't stress how great this book is, so please do not forget to pick it up if you plan on learning shell commands.
If you have any questions about programming, ping me, or any of the other helpful people on Null Byte!
Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.
Other worthwhile deals to check out: