How to learn a programming language (with pictures)

Table of contents:

How to learn a programming language (with pictures)
How to learn a programming language (with pictures)
Anonim

If you are interested in creating computer programs, mobile applications, websites, games or any other type of software, you will have to learn to program. Programs are created using a programming language. This language allows the program to work with the device on which it is running, be it a computer, a mobile phone or any other type of hardware.

Steps

Part 1 of 6: Choose a language

Learn a Programming Language Step 1
Learn a Programming Language Step 1

Step 1. Determine your area of interest

You can start learning with any programming language (although there are some that are definitely "simpler" than others), so you should start by asking yourself what you want to achieve by learning a programming language. This will help you determine what type of programming to pursue and will give you a good starting point.

If you want to learn web development, there is a large set of different languages that you must learn and they differ from the languages needed to develop computer programs. Mobile application development requires a different skill set than when programming desktop applications. All of these decisions will influence your direction

Learn a Programming Language Step 2
Learn a Programming Language Step 2

Step 2. Consider starting with "plain" language

Regardless of your decision, you should consider starting with simple, high-level language. These are especially useful languages for beginners as they teach basic concepts and thought processes that can be applied to virtually any language.

  • The two most popular languages in this category are Python and Ruby. Both are object-oriented languages for web application development and use human-readable syntax.
  • "Object-oriented" means that the language is built on concepts of "objects" or data collections and their corresponding manipulation. This is a concept that is used in many advanced programming languages such as C ++, Java, Objective-C, and PHP.
Learn a Programming Language Step 3
Learn a Programming Language Step 3

Step 3. Read some basic tutorials for different languages

If you're still not sure about the language you want to use to start learning, read some tutorials for different languages. If some language makes more sense to you than others, give it a try to see if you like it. There are countless programming tutorials available on the internet, including many on wikiHow:

  • Python: a great language to start with that is also very powerful once you get familiar with it. It is widely used to create web applications and even to develop some games.
  • Java - Used in countless types of programs, from games or web applications to ATM software.
  • HTML - An essential starting place for any web developer. Knowledge of HTML is essential before moving to other web development languages.
  • C: One of the oldest languages, C is still a powerful tool and is the foundation for modern languages like C ++, C #, and Objective-C.

Part 2 of 6: Start Small

Learn a Programming Language Step 4
Learn a Programming Language Step 4

Step 1. Learn the basics of the language

While the parts of this step will vary depending on the language you choose, all programming languages have fundamental concepts that are essential for building useful programs. Learning and mastering these concepts early on will make it easier to solve problems and create powerful and efficient code. Here are some of the basics of most programming languages:

  • Variables: A variable is a way to store and reference changing pieces of data. Variables can be manipulated and usually have types defined as "integers", "characters", among others. These types allow you to determine the type of data that can be stored. When coded, variables usually have names that make them identifiable to humans. This allows a simpler understanding of how the variable interacts with the rest of the code.
  • Conditional statements: A conditional statement is an action that is performed depending on whether the statement is true or false. The most common form of conditional statement is the "If-Then" statement. If the statement is true (for example, x = 5) then something happens. If the statement is false (for example, x! = 5), something else happens.
  • Functions or subroutines: the real name of this concept varies depending on the language. They are also often called "Procedure", "Method" or "Invocable Unit". This is basically a small program within a large program. The program can "call" the function many times, allowing the programmer to create complex programs efficiently.
  • Data entry: This is a broad concept that is used in almost all languages. It involves controlling and storing the data that users enter. How this data is collected depends on the type of program and the input methods available to the user (keyboard, files, etc.). This concept is closely linked to data output, which is the way to show the results to the user, either through the screen or through a file.
Learn a Programming Language Step 5
Learn a Programming Language Step 5

Step 2. Install the necessary software

Many programming languages require compilers, that is, programs designed to translate code into a language that the computer can understand. Other languages, such as Python, use an interpreter which can run programs instantly without the need for a compiler.

  • Some languages have IDEs (Integrated Development Environment) that typically contain a code editor, a compiler or interpreter, and a debugger. This allows the programmer to carry out all his functions in one place. IDEs sometimes include visual representations of the directory and object hierarchy.
  • There are many code editors available on the internet. These programs offer different ways to highlight syntax and provide other useful development tools.

Part 3 of 6: Create Your First Program

Learn a Programming Language Step 6
Learn a Programming Language Step 6

Step 1. Focus on one concept at a time

One of the first programs that is usually taught is the "Hello world" program. It is a very simple program that displays the text "Hello world" (or some kind of variation) on the screen. This program teaches novice programmers the syntax for creating a basic, functional program and also shows how to handle data output. By changing the text you can learn how the program handles basic data. These are wikiHow guides on how to create the "Hello World" program in various languages.

  • How to write a Python program that displays the phrase "Hello world"
  • How to Write a Hello World Program in Ruby
  • How to Create a Hello World Program in C
  • How to Write a Hello World Program in PHP
  • How to Write "Hello World!" in Visual C Sharp
  • How to create your first Java program on Ubuntu Linux
Learn a Programming Language Step 7
Learn a Programming Language Step 7

Step 2. Learn by analyzing examples from the internet

There are hundreds of example codes on the internet for practically all programming languages. Use these examples to examine how the different aspects of language work and how the different parts interact. Take parts of different examples to create your own programs.

Learn a Programming Language Step 8
Learn a Programming Language Step 8

Step 3. Examine the syntax

Syntax is the way the language is written so that the compiler (or interpreter) can understand it. Each language has a unique syntax, however some elements can be part of several languages. Learning syntax is critical to learning how to program in a language and is often what people think of when they think of computer programming. In reality, it is nothing more than the foundation on which other more advanced concepts are built.

Learn a Programming Language Step 9
Learn a Programming Language Step 9

Step 4. Experiment with changes

Make changes to your sample programs and then evaluate the results. By experimenting, you can learn what works and what doesn't much faster than reading a book or guide. Don't be afraid to break your program; learning how to fix bugs is an important part of any development process, and new things rarely work right on the first try.

Learn a Programming Language Step 10
Learn a Programming Language Step 10

Step 5. Start debugging

When you are programming, you are inevitably going to experience errors. These errors can manifest themselves practically anywhere. The errors can be harmless oddities in the program, or they can be serious flaws that prevent the program from compiling or running. Finding and fixing these bugs is an important process in the software development cycle, so get in the habit of doing it early on.

As you experiment with changing basic programs, you are going to run into things that do not work. Discovering how to take a different approach is one of the most important skills of a programmer

Learn a Programming Language Step 11
Learn a Programming Language Step 11

Step 6. Comment out all your code

Virtually all programming languages have a "comment" feature that allows you to include text that is not processed by the interpreter or compiler. This allows you to leave a short but clear explanation written in human language about what the code does. Comments not only serve as an aid to remember what your code does within a large program, but it is an essential practice in collaborative environments, since it allows others to understand what your code does.

Part 4 of 6: Practice regularly

Learn a Programming Language Step 12
Learn a Programming Language Step 12

Step 1. Schedule every day

The most important thing to master a programming language is to spend time with it. Even a simple language like Python, which only takes a day or two to understand its basic syntax, takes a long time to become a true professional at the language. As with any other skill, practice is the key to becoming more proficient. Try to schedule at least once a day, even if it's just an hour between work and dinner.

Learn a Programming Language Step 13
Learn a Programming Language Step 13

Step 2. Set goals for your programs

By setting realistic but challenging goals, you can begin to solve problems and propose solutions. Try to think of a simple application, such as a calculator, and develop a way to create it. Use the syntax and concepts you learned and apply them in practice.

Learn a Programming Language Step 14
Learn a Programming Language Step 14

Step 3. Talk to others and read other programs

There are many programming communities dedicated to specific languages or disciplines. Being part of a community can be very helpful for your learning. You will get access to a variety of examples and tools that can help you in your learning process. Reading the code of other programmers can inspire you and help you understand concepts that you have not yet mastered.

  • Take a look at coding forums and internet communities dedicated to the language of your choice. Make sure you participate and don't just ask questions. These communities are typically seen as a place for collaboration and discussion and not just a question and answer site. Feel free to ask for help, but be prepared to show your work and be open to trying different approaches.
  • Once you have some experience, consider going to a developer event. At these events, people or teams compete against the clock to develop a functional program, usually based on a particular theme. These events can be a lot of fun and it's a great way to meet other programmers.
Learn a Programming Language Step 15
Learn a Programming Language Step 15

Step 4. Challenge yourself to make things more fun

Try to do things that you don't know how to do yet. Research ways to accomplish the task (or a similar one) and then try to implement that in your own program. Try to avoid being pleased by a program that "just" works; Do your best to ensure that all aspects of the program work perfectly.

Part 5 of 6: Expand Your Knowledge

Learn a Programming Language Step 16
Learn a Programming Language Step 16

Step 1. Attend training courses

Many universities, community colleges, and community centers offer coding classes and workshops that you can attend without having to be part of that institution. This can be very helpful for novice programmers as they allow you to get help from experienced programmers and communicate with other local programmers.

Learn a Programming Language Step 17
Learn a Programming Language Step 17

Step 2. Buy a book or borrow it

There are thousands of educational books available for any programming language. While you shouldn't base all your knowledge on books, they can be a great reference and often contain a lot of very useful examples.

Learn a Programming Language Step 18
Learn a Programming Language Step 18

Step 3. Study logic and math

Basic arithmetic is used most of the time when programming, but it may help to learn more advanced concepts. This is very important especially if you plan to develop complex simulations or programs with advanced algorithms. Studying logic, primarily computer logic, can help you understand how to have a better focus when solving problems in advanced programs.

Learn a Programming Language Step 19
Learn a Programming Language Step 19

Step 4. Never stop programming

There is a popular theory that it takes at least 10,000 hours of practice to become an expert. While this is a matter of debate, the general principle still holds: Mastery takes time and dedication. Don't expect to learn everything overnight, but if you stay focused and keep learning, there's nothing stopping you from being an expert in your field.

Learn a Programming Language Step 20
Learn a Programming Language Step 20

Step 5. Learn another programming language

Although you can surely manage to master a single language, many programmers increase their chances of success in the field by learning multiple languages. Their second or third language is usually complementary to their primary language, allowing them to develop more complex and interesting programs. Once you have a good understanding of your first programming language, it may be time to learn a new one.

You will surely feel that learning your second language was much easier than the first. Many programming basics are the same in all languages, especially if the languages are closely related

Part 6 of 6: Apply your skills

Learn a Programming Language Step 21
Learn a Programming Language Step 21

Step 1. Enroll in a four-year program

While not strictly necessary, a four-year program at a college or university can introduce you to a wide variety of different languages, and it will also help you connect with professionals and other students. This method is certainly not for everyone, and many successful programmers have never attended a four-year institution.

Learn a Programming Language Step 22
Learn a Programming Language Step 22

Step 2. Make a record of your work

As you develop programs and expand your knowledge, be sure to save your best work. You can show this record to recruiters and interviewers as an example of the work you do. Make sure to include any jobs you did on your own and that you have permission to include jobs you did with another company.

Learn a Programming Language Step 23
Learn a Programming Language Step 23

Step 3. Work on your own

There is a very large independent market for programmers, especially mobile app developers. Do a few small jobs independently to get a feel for how business programming works. You can often use these jobs to improve your job posting and post them as a published job.

Learn a Programming Language Step 24
Learn a Programming Language Step 24

Step 4. Develop your own free or commercial programs

You don't have to work for a company to earn money programming. If you have the necessary skills, you can develop software on your own and release it for sale, either through your website or through another software store. You must be prepared to support any software that you put up for sale, since clients will use the program to work.

Freeware is a popular way to distribute small programs and utilities. The developer doesn't get paid, but it's a great way to build a name and get noticed in the community

Advice

  • If you're interested in game programming, look into Python, C ++, and Java. Of these three, C ++ is probably the best performing language, Python is by far the easiest to learn, and Java is capable of running on Windows, Mac OS, and Linux without having to adapt code.
  • Learn about free software. Study the source code of the programs available in the Free Software Directory. Why reinvent the wheel when you can simply improve it? Just make sure you understand what it is you are programming.
  • For most people, programming something that appeals to them or that they can use is more interesting than reading the examples in a book. Use a search engine to find out about projects that interest you.
  • When learning something new, it helps to implement it on your own and then tweak the design, predicting the results to make sure you understand the concept.
  • It uses the updated programming interfaces and official reference materials published by the creator of the software.
  • The references are there to help you. Don't be ashamed if you don't remember everything by heart; this comes with time. The important thing is to know where to find reference material.
  • To practice, try teaching other people. Not only will it make you someone more competent, but it will allow you to think more deeply by gaining different points of view.

Popular by topic