the following introduction is based on my personal thoughts about learning to code. If you use it, please make sure to go through all its steps. I went into details only when it was necessary - usually the linked sources are more than enough.
First thing should be to learn the very basic terms of programming: variable, type/data structure, array/list, if, for loop, while loop, function/method, class. There are many different sources for these basics, my recommendation is Codecademy. After a short registration you can open the catalog and browse the free trainings.
Choose beginner training of Java or Python. These are the most-used languages today (with Javascript - but let's learn about that later), sooner or later you will need both of them. Python is faster to learn, you can write shorter code for a task. Java is very exact, in the beginning there will be some things you don't see - but as the code grows, it may look more structured.
You can choose either, both will be a great thing to learn. This intro is rather Python-based.
note: C# and Javascript are also very typical first languages. C# is very similar to Java, but unfortunately there is no Codecademy training today for C#. If you will stop coding on a training platform and move to a desktop code editor program (IDE), you may consider using your Java basics knowledge to do C# in Visual Studio. It is absolutely okay, they are very similar and Visual Studio is the best IDE today.
Javascript is also very good, you will learn it soon. I don't recommend it for starting because Javascript trainings are usually frontend trainings - and we don't want to limit ourselves with frontend, we learn general basics.
You should use your knowledge as soon as possible. Try your Codecademy training codes in a desktop environment and modify them as you wish. Figure out own small projects, making small steps ahead every day.
You can download Python 3 here. It provides a tiny code editor which is perfect for a beginnner. After installation you can simply
- open Python Shell (IDLE)
- click File/new File
- write your code there, like
print ('let get it started')
- then save it and click Run/Run Module
- Tadaaam, it is working. Or it is not and you see a red message
- Go on, code, solve problems and find new problems to work on, to code on
If you have any problems, any red messages, you have to see the next step: asking
For Java the best start may be to download Eclipse or Netbeans with Java EE SDK.
Most of the time a programmer does not write code. We try to figure out why it doesn't run. (or why it does...) To do this we ask, ask and ask again. Usually real, breathing, alive people are not available. But we have the internet, we have Google, we have Stackoverflow and we have so many other possibilities.
First, word your question in your mind. You have to know the real question. Many programmers use a rubber duck to talk to. Leave behind "why it is bad?", "Why does it fails to run again?" and search something more specific. Your search words may contain:
- programming language
- the language/library functionality failed, like "for loop" or "sort function in bluebird library"
- the problem you've failed to solve
- error message
Some examples:
python .sort() doesn't work
python file reading FileNotFoundError: [Errno 2] No such file or directory
how to sort in python
python codecademy sorting training doesn't run
stackoverflow python sorting fails
note: It is a very important practice to delimit the "bad part" in your code. If you have a long code which fails, pick the part you think is bad and run that alone.
you write a Python code to file yourcode.py
which is reading names from a file hole.txt
, selecting all the people called Samuel
and sorting them by last name. Your code fails. What to do?
- Check error message. It may be something like that:
FileNotFoundError: [Errno 2] No such file or directory: '../rabbit/hole.txt'
. It usually means that your reference is bad. The following line suggests that your folder structure is something like:
- yourFolder
- codeFolder
- yourcode.py
- rabbit
- hole.txt
- codeFolder
If your folder structure is different, you should modify it. If it looks good, maybe your filename is bad or the file doesn't exist.
- If you get an error message you don't know yet, no problem, search it. For example try
python file reading FileNotFoundError: [Errno 2] No such file or directory
. - Search how other people solve this question and learn from their code. You can be pretty sure that your problem is not a new one, someone, somewhere already faced it and wrote an article about it or posted it on a Q/A site.
Google is very handy but sometimes you should be more specific.
- Q/A sites: Stackoverflow is the all-the-time most popular Q/A site on programming. You can simply type in your question to its search bar and usually there will be a question with detailed answers. Anyway, Stackoverflow grows, it has a mother site called StackExchange where you can search in any topics like Mathematics or English language. You can search SuperUser for hardware/software managment and there are still 171 other subsites for different areas.
- documentation: all the programming languages and libraries should have documentation. Some of them are better, some of them are really hard to read but it is always a good idea to read them. For example: Python docs on sorting
- tutorial sites: Usually you won't find direct and free trainings sites like Codecademy, but there are many tutorials which are nearly as decent. Tutorialspoint and W3schools are great, use them, read them, search in their search bar or simply Google
Python sorting tutorials
and remember that these sites are worth clicking on. - Youtube: it is a bit chaotic, so there is no guarantee that a solution will work for you too, but pretty often a home-made video tutorial is the most comprehensible for a typical problem
- By the time you will find more and more complicated problems. You will need other people's code. The greatest source for this is Github which is the center of uploading free codes and community development. There are short materials called Gists and real solutions called Github repositories.
It is really important to practice. As a beginner you will practice algorithms: have a list and find maximum, minimum, a specific element, summarize values, sort them. By the time you should learn how to use programming libraries, how to build a real solution. If you need exercises, just google "coding exercises" or "programming challenges". There are specific sites to do it, I can really recommend Hackerrank for coders or Project Euler for more fascinating problems. I am also working on a collection of exercises, see it here.
For programming we need programming languages* like Python and Java. But we also need to store, transfer, visualize and organize data. For example you would like to send your ID info from your application to another. Your JSON file will look like:
{
"firstName": "John",
"lastName": "Smith",
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
}
You can learn more about JSON and XML in the sites mentioned, for example: W3Schools about XML
Markup languages do much more: they store a whole document and also tells how it should be presented. Internet is based on HTML and CSS. It is absolute must to be learnt, so check out Codecademy HTML & CSS trainings or other trainings on them.
*there are arguments if markup languages are programming languages but you don't have to worry about this theoretic question now
You may want to do a Javascript training now or at least read the basics on a tutorial site but you can skip it too and just check out the W3schools article below. I think it is satisfying to see how you can make a simple functionality on a visual interface (a website).
Use Javascript in an HTML file - W3Schools
You have done a great job with the trainings above. You know how to write a function to open a file, read data, and to find or organize information. You also know how a website looks like behind and that clicks on a button are triggering JavaScript functions. But the real-life projects are still much complicated. All of them use code libraries, most of them are based on frameworks (which are big libraries with some extra tools).
I do know that it may be shocking but I believe that you should now just jump inside it. A very great start is the Django Girls tutorial which is available on many languages, including my mother tongue Hungarian. It is made for beginners so it will tell you how internet works and the basics of Python. In some hours you will build a blog with it using Django framework and Git version controlling. Don't panic! Just go on and do it. In the end it will all make sense.
If you've finished with it, read it again and try to understand all the small steps. You can find a Git training here and it is worth to check out the tutorial's links here.
Good job! You now have a real-life application. You can customize it, do whatever you want to. If you want Java back or a phone app, now you are ready to buy a 16$ training on Lynda, Udemy or Pluralsight. You can find Codecademy-like basic trainings on Sololearn (nice mobile code learner apps), Hackerrank (instant developer rating helps to get a job) and Freecodecamp (a good zero-to-hero curriculum based on Javascript). There are endless possibilities how you can grow, learn and create wonderful new products.
I did not include databases above as it is not mandatory to start - but sooner or later you will need it. Do a SQL training on Codecademy, it is pretty simple and straightforward. You can download Postgres and PgAdmin3 (this is the program where you can try your database commands) and do a simple database. Postgres, MySQL, MariaDB are all pretty popular but the differences are not so big.
Hargitai Soma 2018
see my Github profile here, contact me via email or on facebook