A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
English Original: Learning Your first Programming Language
This article is excerpted from one of the chapters of my forthcoming new book, The Complete Software Developer's career guide.
OK, so decide what programming language you want to learn, now let's start learning.
All you have to do is open a book and start reading, is that it?
Not all of it. I mean, you can learn that way-if you like setbacks.
Do you remember what we talked about to learn the best through hands?
This is the gist of this article.
I will give you the ideal layout for learning the first programming language, you should not only learn this layout method, but also enjoy mastering it-if not mastered.
Learning the first programming language may be the hardest thing to learn about programming, but not necessarily.
Most programmers – including myself – try to do something by reading a book, encounter setbacks, and then reread and continue to try things until they finally work as expected.
What I will share with you is the experience of teaching and training software developers to learn the first programming language and improve their language skills. I also added my own experience in learning languages such as c++,c# and Java.
Basically, in this article, I'll show you some of the things I've done-what I know now-if I were you, and now I'm going to learn the first programming language.
Start by looking at a working application
Most programmers, when they want to learn programming, often start with a book.
While there are some good books that will teach you how to program, I think the best start is to look at the source code of an application that works, and then try to figure out as much as possible what is happening. It's hard.
It makes people feel uncomfortable, but don't be afraid. Get used to the uncomfortable feeling. This is the only way to grow.
What I want you to do is choose an open source application--preferably a popular one--to be well designed--and then browse through its source code. You can find lots of items on GitHub, so I suggest you go there and look for them.
And, you'd better be able to download the code and build and run the app yourself--though that's beyond the scope of the book. If you have a friend who can help you with these things, that's great. Of course not, it doesn't matter.
It is important that you explore the code to understand how the syntax of the programming language looks like, and try to read the code to see if you can understand or make sense of it.
Use the application itself, if possible, so that you can feel the relationship between the code and the code's role.
Like I said, it makes people feel uncomfortable. You might think you can't read anything.
Again, that's okay. You just have to do your best to see how you can figure out how one or two things work, or what changes you can make in your code to change functionality in a way that makes sense.
Also, get an overview of how the code is named and how it is organized. Just as you are an archaeologist trying to understand some of the writings of ancient civilizations. Such a start can make you more purposeful than most programmers who do not know what programming language they are going to learn.
It's always good to get a rough idea of the local situation before you start your journey. Programming is no different.
Find some good resources or books, and look at them roughly once.
To get a better understanding of the local situation before sailing, the next thing to do is not to read the programming books over and over again, but to pick up some other resources--such as videos, articles, or tutorials--to look at them roughly. Again, it makes you feel uncomfortable, because a lot of what you see doesn't mean you understand what it means.
But...... You need to get involved in this field. You just have to know exactly how big this thing is, what you have to learn and what common concepts are.
These prerequisites work when you probably understand what kind of things to learn and how concepts are built on top of each other, and you get results.
Learn how to create "Hello world"
Well, you still don't have to "read" or get started programming on this point.
It'll make you want to vomit later-if you want. (without following these steps, you can actually learn programming languages as well.) ）
What you need to do at this point is to create the most basic program possible, no matter what programming language you are learning.
Remember the "How to develop technical skills" We talked about? This is the goal here. You want to start as soon as possible so that you have enough confidence and knowledge to apply.
A very basic procedure that you want to start is called "Hello World". Most programming books begin with the creation of a "Hello World" program, which usually refers to the output "Hello World" to the screen.
This may not require much knowledge of the programming language, but it requires familiarity and testing of the basic toolchain needed to build and run the program.
If you are reading a book about programming languages, the book should contain a "Hello World" program for you to create.
If not, Google search for "Hello World + Your programming language". An example can be found right away. By creating the "Hello World" program, you can also learn the basic structure of the programming language program.
Learn basic constructs and test them with real questions
If you use the appropriate books or some form of tutorials to learn the programming language, you can now learn from them.
At this point, you will feel that the book or course you are reading is not as mysterious as you initially thought.
Now all you have to do is familiarize yourself with each of the basic constructs of the programming language you are learning, and then use these constructs to write some code.
You need to try and think as realistically as possible to relate what you have learned to your problems and applications, so that you can better understand and remember this knowledge when you apply your skills to practical problems.
Here are some of the basic constructs that are included in most programming languages:
Here are some good news.
Once you understand these basic structures and know how to use them, you have a basic knowledge of the language. Yes, the syntax may be different, but this is the core of programming. You may spend a lot of time at this stage.
Do it your own way, one at a time to learn the structure of the programming language, and to actually write some code to apply each structure. If you are taking your own way, then you need to determine what the structure is and the order of learning.
If you are reading books or learning tutorials (preferably multiple books and multiple tutorials), then the specific path should already be present in front of you, even with some examples and challenging tasks. Try to be sure you understand what you're learning and how to apply them.
Now you can go back to see your first step to see the source code, see how much you can understand.
Know the difference between a language function and a library
One thing that often trips a novice programmer--especially today's programming language--is to know what part of the language is, and what part of the standard library The language comes from.
Usually, the difference is not very clear, because, habitually, you will use the standard library to write code very frequently.
Never mind. You need to understand the programming conventions of the programming language you are learning, but you should be particularly careful to try and point out the actual language parts and the parts of the libraries that are commonly used in languages.
It seems to be a bit of an egg to pick bones, but I think it's important because it can be used to straighten out the messy grammar in your head right now and help you categorize and organize more meaningfully.
You will understand that for most programming languages, the actual parts of the language are not very large and easy to learn, but the standard libraries are large and it is much more difficult to understand them in your own way.
Today's programming is more about knowing how to use libraries and frameworks than being an absolute expert in language. This is one of the reasons why this distinction is important.
You become a better programmer by recognizing what is not part of the language, but part of the library, and knowing how to find libraries to accomplish common tasks in the appropriate language.
Review existing code to understand the meaning of each line of code
At this point, you should be familiar with the main concepts of the programming language you have learned and have used most of the programming language features in real-world examples.
You also have an in-depth understanding of the differences between the language itself and the libraries used in conjunction with the language. But you may still feel less comfortable with the programming language, or you don't actually understand it.
It's a stage where you feel you can understand how everything works, but don't know how to put them together and write a real application. Many junior programmers tend to stay at this stage and feel frustrated that they will never be a real programmer.
One of the best ways to get out of this mess and make sure you don't have the knowledge you need is to look at the existing code and make sure you understand exactly what each row and each statement is doing in your code. (Even if you don't know the reason sometimes, knowing the exact process is still an improvement.) ）
Here the existing code can be used in the first step when you look at the project's source code inside a random project file. Open a file and double-check each line of code in the file to make sure you know exactly what it does.
If you don't understand-there are a lot of things you don't understand-then take some time to think about them and look at where you don't understand. A little boring. It may even be boring, but it's worth it.
When you arrive at a stage where you think you can read any line of code and understand what it does--again, knowing why it doesn't matter at this point--means you're ready to move on.
Build things, build a lot of things
Now it's time to actually start using the programming language.
At this point, you've been able to write small programs that use most of the language features, but you'll be able to feel more deeply about the programming language only if you really want to build the application.
Pick a few small projects – not too big – and build the application.
Don't be too ambitious to know that you can't eat a big fat person, so don't try to do anything on the platform or UI-intensive at this stage. It is best that your application only outputs text to the screen and temporarily accepts input only from the keyboard.
The goal is to build a simple application that focuses on the use of programming languages and standard libraries, and does not add additional frameworks for platform functionality-and this is what comes next.
Doing so can help you increase your confidence in programming languages and understand what language constructs you need to use to accomplish your goals.
Here are some simple project ideas to help you get started:
Apply a programming language to a specific technology or platform
By this time, you have mainly learned about how to use programming languages under closed conditions.
This is intentional, because you need to understand and familiarize yourself with the programming language itself and its standard library before adding additional complexity to the environment and the frameworks needed to build a real application.
In order to create something useful in a programming language, you need to apply the language to a particular technology or platform.
So, at this point, you need to identify a few small projects that you can accomplish that need to use programming languages on a particular platform.
For example, suppose you are learning Java. Until now, you'll be writing Java code that works on any Java-run platform because you use the standard library most of the time and only input and output to the screen or file.
At this point, you may decide to use Java to build an Android application. You need to learn how to build Android apps and knowledge about the Android framework. However, since you are already familiar with Java, there is no need to learn a lot of things at once.
Of course, you can learn Android and Java together, in fact, I did a pluralsight course to teach how to do it-but in order to actually master the language and avoid confusion, from the platform or technology independent language, and then combine them can be much easier.
Now, you use programming languages to develop specific and professional skills that can be useful when looking for a job.
Choose any platform or technology you want to use, and use these platforms or technologies to create small applications.
I also suggest that you should focus on a single technology or platform at this time. You'll always learn more.
Through this specialization, you can not only understand what you need to learn, but also give you a deeper understanding of the knowledge and mastery of specific technologies, which will make you more confident and improve the marketability of your skills.
Solve difficult algorithmic problems for better mastery of language
So far, you should feel more comfortable with the programming language you are learning.
You already know a lot about it and have used it in a variety of different applications.
You should have a specific technology or platform for applying skills, and using this technique to create a basic application feeling is already in hand and more comfortable.
Still, you may not think you have mastered this programming language.
Don't worry, it's normal.
When I first learned C + +, I remember that even when I knew everything about language and had actually created multiple applications in this programming language, and even was hired as a developer writing C + + code, I still didn't think I really mastered the programming language.
I think I am a good C + + programmer, but not great. I really want to improve my C + + skills, but I don't know what to do. Then I found this Code competition website called TopCoder.
Every week, there's a new set of programming challenges that you can play with other programmers to solve some fairly difficult algorithmic problems. At first I was afraid of the extreme. I couldn't even solve the simplest problem.
I went to see other people's solutions, and I don't know how they came up with the solution or how their code works. They use the C + + code in a way that I never imagined. But then, as time went on, as I persevered to try to solve the problem and see how others solved it, I grew up ... 1.1 points, more and more excellent.
I found patterns to solve certain types of problems. I'm starting to really understand how to take advantage of the C + + features I've overlooked before. I learned how to use standard libraries and language features and data structures efficiently to solve complex problems. I became not only good at c+ +, but also very good. I finally felt like I had mastered the programming language. That's what I want you to do.
You don't have to go to TopCoder to compete, there are a lot of places where you can practice solving algorithmic type programming problems.
I have mentioned a good resource for this kind of problem, and some are:
It's very difficult for you to solve these problems at first, it doesn't matter. That's the way it is.
You will find that over time you will begin to realize that there are only a handful of problem types, and you can immediately point out how to solve these problems.
At first, you have no clue, don't know what to do, as I said, it's okay-just keep trying.
Also, don't forget to look at how other people are solving the problems that you're struggling to cope with. Try to understand why they want to solve a particular problem in this way.
This is one of the best ways for me to learn how to solve such problems.
I'll take a look at TopCoder's top programmers ' solutions, and I've learned a lot from them.
Once you can solve these types of programming problems with the programming language you've learned, you're not only pretty close to mastering the language, but coding the interview will be a breeze because the other candidates can only sweat and shame the problem.
Even writing a book is a pretty big business, and I'm happy to be on this journey.
I hope you can go along with me on this road.
Translation Code Agricultural Network-Xiao Feng00From: www.codeceo.com
[Go] Learn your first programming language
Start building with 50+ products and up to 12 months usage for Elastic Compute Service