Programming 101

From Grundy
Jump to: navigation, search

This is a comprehensive (hopefully) guide to starting out as a newbie in this giant world of programming. Remember, in this page we will not teach you how to code. Instead, we will direct you to some amazing tutorials online along with some personalized inputs on the general procedure.

If you have programmed before, you may wish to skip the first few sections. We will also assume that you are well versed with using a computer.

Absolute Newbie

It's never too late! Before you actually start programming, it's a good idea to familiarize yourself with basic markup languages like Markdown and HTML. These languages aren't really programming, but we recommend them as,

  • They don't require any extensive setup.
  • They are an excellent preview to writing code, as for the first time you will see complicated symbols produce beautiful output, the real essence of programming.

To begin writing markdown, you will need to have an online editor. Simply Googling "markdown online editor" (yes, you need to learn the art of Googling, as we shall describe later) should get you to websites like dillinger.io and stackedit.io. Markdown is easy to learn and you will be surprised to know how important it is in these days. You can find a good beginners tutorial by Googling "markdown tutorial" (again, we can't emphasize how important Google is) which should get you to http://www.markdowntutorial.com/.

HTML, on the other hand will require a bit of setup and it's better you do a video tutorial since it's your first time doing a programming setup (you have no idea about how hard this can get). HTML is more complicated than Markdown and could need some practice. We wouldn't recommend learning too much HTML as you will end up forgetting most of the tags. The whole idea of this exercise is to provide a preview to real programming and not to make you a web developer.

Here are a few playlists on video tutorials HTML on YouTube.

Text Editors

If you completed the previous tutorial on HTML, you might have realized that most of the video tutorials ask you to write HTML in a vanilla Notepad file. While this is good to begin with, it's going to make your life very hard very soon. Here is why,

  • No Syntax Highlighting - Yes, you don't see colored text for reserved words, and this is perhaps the biggest problem. You will end up making tons of mistakes making life miserable.
  • No Autocomplete - Modern text editors have an autocomplete feature which autocompletes variable names and reserved words. This makes coding faster and less erroneous.
  • Lack of Formatting - Notepad will not auto indent the code for you when you start writing a block.

All this makes us jump to better text editors. We recommend using Notepad Plus Plus, Vim for Windows, Sublime Text (most of us use Sublime all the time), or a dedicated IDE (Integrated Development Environment) for that language.

However, if you want to code faster than many of your friends would be able to think, learn Vim. On a Unix based system, vimtutor should be your go-to guide.

My First Programming Language

So you've got it all setup, time to code! Unfortunately, there are so many languages out there, it's quite confusing to know where to begin. We actually tried Googling "the best programming language to begin with", and we got a variety of arguments in favour of different languages. This is our take on it.

  • Choose a language which is relevant today. Unfortunately, we don't see too much code in BASIC or its sister languages any longer. It's much better to start off with a language well in usage today.
  • Choose a language which does not require extensive setup.
  • Choose a language which will teach you about the different programming elements without too much abstraction.
  • Choose a language which is simple to learn, but not simple to master.

That being said, these are our recommendations,

  • JavaScript - Extremely relevant in today's web development world. Since it's embedded in your browsers, the same HTML text files can be used to run powerful JS code. The best part about JavaScript is the HTML visual element which makes programming exciting! Lastly, vanilla JavaScript is simple to learn. Modern JavaScript on the other hand, is a never ending pile of libraries which keep making the language more and more complicated.
  • C++ - The language which powers most of the modern software you use. The best part is that so many people still use it owing to its speed and excellence. It will need you to setup a compiler / IDE, but there are excellent tutorials online for this. This language is a low-level language and will give you a very good understanding what goes on inside the software. Unfortunately, it's not so simple to learn. Nevertheless, learning C++ will make most other languages a cakewalk. (Nope, not Rust).
  • Python - The state-of-the-art language many would say. Extremely simple to learn, easy setup, huge library support, the language for many modern software. It's a little slow when compared to C++ and abstracts several key ideas due to it's simplicity. Highly recommended if you want to start doing some amazing things on your computer in no time.

Again Googling for tutorials is the best way forward. Nevertheless, here are some strong recommendations from our side,

  • Automate the Boring Stuff - A Python masterpiece. Starts ground up, and within a couple of weeks I'm sure you will be able to scrape the web, send emails, automate your mouse movements, browse the web and pretty much do anything with Python.
  • Bucky's C++ - A great video series on learning C++ using Code::Blocks.
  • Tutorials Point - A great set of written tutorials for all languages.

Googling for Beginners

This is the last and most important section for programming newbies. Programming has a large amount of syntax, libraries, tricks and setup instructions which are impossible to remember. Luckily, there are a large number of guides online to help you do this. Hence effective Googling is the key to being a good and fast programmer. Here are some general tips,

  • Always prefer StackOverflow / StackExchange answers when you are in a hurry / trying to remember something you've learnt in the past. The answers generally provide the solution directly along with a very short and precise explanation.
  • Try not to just use StackOverflow while googling something for the first time, especially when you are not in a hurry. It's a good idea to look at the official documentation (usually hyperlinks in good StackOverflow answers) to get an idea about how exactly things work.
  • Try to write "keywords" in your search query rather than long pieces of text.
  • If you get a compile / runtime error, it's often a good idea to query the error message rather than querying "compile error when running c++ code". Most errors have been encountered earlier and extensively discussed online.
  • If you fail to find a solution online after extensive Googling, you can ask the question on StackOverflow. Be sure you read How to Ask? and study a few questions before actually asking the question unless you wish to receive a large number of downvotes.
  • If you fail to find good examples (of an API function for instance) on Google, you should search Github with the exact function / API name. You will see a lot of code having used that function. Of course, the exact API name is essential. (for instance, prefer tf.nn.bidirectional_dynamic_rnn over bidirectional dynamic rnn for much better results).

You can have a look at an example in the Googling for Beginners article.

After My First Language

Well, congratulations! You have passed the first test. Unfortunately, there is still a long way to go.
To become a better programmer, first look at Software Development. Here are some broad areas to begin exploring next,

  • Algorithms & Computer Science - Yes, know that you know how to code, time to begin learning some algorithms. This will help you solve several programming problems, and write better / efficient code in general. If you do this well, you can start think about beginning Competitive Programming. Here is a great lecture series by MIT to begin using algorithms in Python MIT OCW 6.006.
  • Web Development - There is a lot of demand in this area, and a lot of exciting new libraries coming up every day. Please have a look at our Web Development article.
  • Open Source - A lot of code of major software (Firefox for instance), is available online and you are free to contribute in improving it. The famous Google Summer of Code (GSoC) program supports open source development. Please have a look at our Open Source article for more on this.
  • Scientific Computing - All modern research is powered by programming. Writing code to aid in scientific research is called scientific computation. If you are a math and science geek who would love to see coding enhance the action you learn in theory and try in experiments, this is the place to go. Please have a look at our Scientific Computation guide. If you are interested in Machine Learning, please look at our Machine Learning guide. You can also have a look at our High Performance and Distributed Computing guide. If you want a different flavour of hacking, see our Spreadsheet Programming guide.
  • Software and Game Development - Yeah, all the games you played required thousands of lines of code. Time to begin this wonderful journey. Have a look at our Game Development and Software Library Guides.
  • Network Security - Learn to hack! (Ethically of course). There is a lot going on here and good network security engineers are in the demand everywhere. Take a look at our Network Security guide.
  • Digital Design - This is a must if you aspire to design computer systems or microprocessors. Have a look at our Digital Design guide.
  • Embedded Systems - The code that powers robots, microcontrollers, digital watches, and all the small wonderful things around us. Arduino, Processing, Embedded C, AVR, you name it! Have a look at our Embedded Systems guide.

So the key idea is to not just focus on learning a new language but to learn more about one of these eight broad areas.

Reading Documentation

After spending sometime Googling about stuff and improvising on already available codes from blogs and StackOverflow, you may start feeling quite confident about yourself. That is great, but remember that there is a difference in being able to modify an existing code, and building something right from the scratch. That is where the art of reading documentations comes into play. Most of us find documentations quite intimidating, but it is extremely important to know how to read one.
Try reading about the functions or features you use while coding in the documentations to start with. If you want to do big project let's say GSoC in the future, you need to be patient enough to read the documentations, else there is no way you can understand a totally new codebase, with not so many blogs (code snippets) available online to build upon. Keep following blogs and tutorials, but remember the importance of the official documentation as well.

See also