How to learn a programming language

Author: Sara Rhodes
Date Of Creation: 11 February 2021
Update Date: 28 June 2024
Anonim
How To Learn a New Programming Language - FAST
Video: How To Learn a New Programming Language - FAST

Content

If you want to learn how to create computer programs, mobile applications, websites, games, or any other software, you actually need to learn how to program. Programs are written in programming languages, which enable the program to work - be executed by a computer, smartphone or other computing device.

Steps

Part 1 of 6: Choosing a Programming Language

  1. 1 Decide on what interests you. Of course, you can start learning any programming language (hereinafter PL). True, some programming languages ​​are much easier to learn others ... Be that as it may, you need to decide on what you will learn a programming language for. This will allow you to decide exactly what you need to learn, and it will just be a good starting point.
    • Does web development warm your soul? The list of PLs that will be useful to you differs significantly from the list of PLs required for writing computer programs. Mobile development - your childhood dream? This is the third list. What you teach depends on what you want to do.
  2. 2 Start with a simpler language. Whatever you decide for yourself, it's worth starting with relatively simple high-level languages. These languages ​​are especially good for beginners, as they allow you to master the basic principles and understand the general logic of programming.
    • Python and Ruby are most often remembered in this context. These are two object-oriented programming languages ​​with quite understandable syntax, used mainly for creating web applications.
    • "Object-oriented PL" is based on the representation of everything in the form of "objects", connecting the data and methods of their processing, and the subsequent manipulation of objects. Such PLs are, in particular, C ++, Java, Objective-C and PHP.
  3. 3 Check out the basic tutorials for several languages. If you are still undecided about what to teach, check out the tutorials for several languages. If something hooks you - try to understand that YP a little better. This task is simple, since there are more than enough educational materials of the introductory level on PL in the network:
    • Python is a great language for beginners, but it has quite a lot of potential if you learn how to use it. The scope of use is web applications and games.
    • Java - used ... oh, it's easier to say where this PL is not used! Almost everything from games to ATM software is Java.
    • HTML is not a programming language, but a markup language, but it is a must for any web developer.
    • C is one of the oldest programming languages ​​that has not lost its relevance to this day. C is not only a powerful tool in itself, but also the foundation for more modern programming languages: C ++, C #, and Objective-C.

Part 2 of 6: Starting Small

  1. 1 Learn the basic principles of PL. Here, of course, it all depends on the language you have chosen, however, the language also has common points that are important exclusively for writing useful programs. The sooner you master all of these concepts and learn how to put them into practice, the better for you and your programming skills.So, here are just a few of the aforementioned "points":
    • Variables - variable data can be stored and called in a variable. Variables can be manipulated, variables have types (in very simple terms - numbers, symbols, and so on), which determine the type of data stored in a variable. It is customary to set the names of variables so that the person reading the source code can get an idea of ​​what is stored in the variable - this will make it easier to understand the logic of the program.
    • Conditional constructs (they are also conditional expressions) are actions that are performed in the event that an expression or a construct is true or false. The most common form of such expressions is the “If-Then” construct. If the expression is true (for example, if x = 5), then action # 1 will occur, and if it is false (x! = 5), then action # 2.
    • Functions - they are called differently in different programming languages: somewhere they are procedures, somewhere they are methods, somewhere they are called units. In essence, functions are mini-programs that are part of a large program. The function can be called multiple times, which allows the programmer to create complex programs.
    • Data entry is a fairly broad concept that is present in almost every programming language. Its essence is the processing of data entered by the user and their storage. How the data will be collected depends on the program and the methods of data input available to the user (from the keyboard, from a file, and so on). The concept of data input is closely related to the concept of data output - that is, how the data will be returned to the user (displayed on the screen, written to a file, and so on).
  2. 2 Install all required software. Many programming languages ​​need compilers - programs that translate program code into instructions that are understandable for a computer. However, there are also other types of programming language (like Python), in which programs are executed immediately, and their compilation is not required.
    • Some programming languages ​​have so-called IDEs (Integrated Development Environment), which include a code editor, a compiler / interpreter and a debugger (debugger). This gives the programmer the opportunity to work on the program, figuratively speaking, according to the principle of one window. The IDE can also include visual representations of object and directory hierarchies.
    • There are also online code editors. These programs highlight the syntax of program code in a slightly different way, and also offer the developer access to a number of useful and simple tools.

Part 3 of 6: Writing Your First Program

  1. 1 Master basic concepts one at a time. The first program that is written in any PL is the classic "Hello World". It is very simple, its whole point is to display the text "Hello, World" (or its variation) on the screen. From this program, people studying PL should learn the syntax of the simplest working program, as well as the way of displaying data on the screen. By changing the text, you can see how simple data is processed by the program. Here are a couple of articles on how to create a "Hello World" program in different languages:
    • in Python;
    • in Java.
  2. 2 Learn from parsing online examples. On the net for any PL you can find hundreds, thousands of examples of programs, programs and just pieces of code. Explore various aspects of your chosen language based on these examples. When creating your own programs, rely on these pieces of knowledge.
  3. 3 Learn PL syntax. What is syntax in the context of PL? A way of writing programs in a special way that compilers can understand. Each PL has its own syntax rules, although, of course, there are common elements. Learning the syntax of a language is one of the cornerstones of learning language programming. Quite often people even think that learning the syntax will make them programmers. In reality, of course, everything is not so - the syntax is the essence, the foundation.
  4. 4 Experiment! How exactly? Modify the sample programs and test the results.This approach will allow you to understand what works and what does not work much faster than if you were studying from a book. Do not be afraid to spoil or "break" the program, because fixing errors is one of the key stages in the software development process. And then, the first time to write a working program ... well, it's almost fantastic!
  5. 5 Start working with a debugger. Programming errors (bugs) are something that you will definitely encounter when you start programming. Mistakes will be everywhere, get ready. They can be harmless, relatively harmless, or, alas, critical, preventing the program from compiling. The process of debugging a program is one of the key stages of software development, we repeat. Get used to fixing mistakes as early as possible.
    • By experimenting with programs, you will inevitably do something wrong, which is good. The ability to fix a program is one of the most valuable skills for a programmer.
  6. 6 Don't forget to comment out the code. Almost all programming languages ​​allow you to add comments to the program code - text that is not processed by the compiler. With the help of comments, you can add simple and understandable descriptions to the program of what this or that function (and not only the function) does. Comments will be useful not only for yourself (sometimes you can get confused in your own code), but also for other people with whom you will work on the program.

Part 4 of 6: Programming Regularly

  1. 1 Program daily. It will take a long time to master a programming language. Lots of. Even Python, a relatively simple programming language, whose syntax can be mastered in a day or two, requires hundreds and thousands of hours of work from anyone who intends to master it perfectly. Programming is a skill, and therefore those who want to master such a skill to perfection need to practice regularly. Try to program every day, even an hour before bed, if there is no other way.
  2. 2 Set goals for your programs. By setting challenging yet achievable goals, you will learn how to solve problems, find solutions, and deal with difficulties. For example, imagine a simple program — say, a calculator — and then think about how you would write it. Put into practice what you have learned so far.
  3. 3 Share experiences and read other people's programs. A huge community has gathered around each YP. If you join the relevant community, you will be very helpful for yourself, as you will have access to more than quality teaching material. Reading someone else's code can inspire you, it can give you strength and help you better understand the programming features that you have slipped on before.
    • Forums and online communities dedicated to programming in your language of choice are the first things to look for. Don't just ask questions all the time, participate fully in the life of the community - after all, these are places where people collaborate with each other, and not provide free training courses. In other words, do not hesitate to ask for help, but do not sit idly by!
    • Having gained more or less decent experience, take part in hackathons or other similar events - competitions where you have to manage to write a special program in the allotted time. Such events are fun and rewarding.
  4. 4 Have fun. Do what you still don't know how to do. Learn ways to solve problems, and then use them in your own way. Try not to be happy that “the program is working and okay” - do your best to make the program work flawlessly!

Part 5 of 6: Broadening your horizons

  1. 1 Sign up for courses. Universities, colleges and educational centers (and not only) run courses and seminars on programming, which can be a great option for beginners. Judge for yourself, where else can newcomers be able to communicate live with experienced specialists?
  2. 2 Read thematic books. How you get access to books is up to you, the point is that on any programming language you can find hundreds of books of varying degrees of usefulness. Of course, your knowledge should not be purely bookish, this is a fact. Still, books have their own uses.
  3. 3 Learn logic and math. Programming is largely tied to basic arithmetic, but more complex points can come in handy, especially in cases where a person is engaged in algorithms or writes a complex program. However, most likely, unless you dig into complex areas, you will not need complex mathematics, but you will need logic, in particular, computer logic, since with its help you can better understand how to solve problems that arise during the work on complex programs.
  4. 4 Never stop programming. There is a popular theory of "10 thousand hours", which says that mastery comes after 10,000 hours spent on this or that occupation. The exact number of hours as a point of achievement of mastery is, of course, a controversial issue, but in general the theory is correct - mastery is the essence of the result of the applied work and the time spent. Do not give up and one day you will become an expert.
  5. 5 Learn another language. Of course, mastering even one programming language will only be a plus for you, but many programmers do not stop there and learn several languages. It will be nice if the second or third programming language that you choose complements the first - then it will be possible to create even more complex and interesting programs. Of course, you need to learn new things only when you have already mastered the old at a decent level.
    • There is every chance that you will learn the second language faster than the first, but this is quite understandable, since many programming concepts are more than widespread, especially among "related" languages.

Part 6 of 6: Applying the Learned Skills

  1. 1 Get a university degree. This point is not required, but years of study can open up something new (or maybe not) and introduce you to the right people (also not a fact). Again, this step is optional, there are many successful programmers who do not have a college degree.
  2. 2 Collect a portfolio. When creating programs and developing as a specialist, be sure to put off the best samples of your work separately - in your portfolio. It is the portfolio that you will show to recruiters and interviewers as examples of what you are capable of. Those projects that you carried out independently and on your own initiative can be added to the portfolio without thinking, but those that you worked on as an employee of a particular company, only with the permission of the relevant persons.
  3. 3 Become a freelancer. Programmers (especially those who specialize in mobile applications) are snapped up right now. Perform a couple of projects as a freelancer - this is useful for a portfolio, and for a wallet, and for experience.
  4. 4 Develop your own software product. Whether it will be paid or not is up to you. After all, you don't have to work for someone to make money coding! If you know how to write programs and sell them, then it's almost in the bag! The main thing is not to forget to provide users with support after the release of the program.
    • The Freeware model is popular for small programs and utilities. In this case, the developer does not earn anything financially, but he gets a reputation and a recognizable name among colleagues in the shop.

Tips

  • Want to create games? Learn Python, C ++ and Java. Of the three, C ++ gives the best performance, Python is the easiest, and Java runs on all operating systems without too much trouble.
  • Learn more about the Free software business. Study the source code of the programs that can be found here. Why, think for yourself, reinvent the wheel when you can take a ready-made bicycle and just improve it? The main thing is to understand what exactly you are programming.
  • For many people, the examples and tasks from a programming textbook are about nothing at all. Try to search for and solve problems that are interesting to you.
  • Learning something new, it will be useful to implement it yourself, then make changes, try to guess the results and, as a result, get closer to understanding the essence.
  • Use modern interfaces and up-to-date versions of the programming language.
  • Additional materials are your friends. There is nothing wrong with forgetting or not remembering something. All in good time, don't worry. The main thing is to know. Where to spy!
  • Teaching others is a good practice to help you not only better understand the material, but also take a detached view of it.