This content originally appeared on DEV Community and was authored by Hunter Johnson
This article was written by Educative's Co-founder and CEO, Fahim ul Haq.
What is the one piece of advice I wish someone told me when I was learning how to code?
I've thought a lot about this question. In fact, we built Educative with this question in mind.
Throughout my career as a software engineer, many of the problems my teams at Microsoft and Facebook worked on centered around designing scalable and performant software systems. Of course, we had to write code as a part of this process, but it took a back seat to problem-solving skills, logic skills, and cost-benefit analysis.
The reality is that professional software developers aren’t just there to code. They are there to solve problems.
People who are starting to learn how to code often get preoccupied with questions like "what language should I learn first?" At this stage, I would argue that this is not the most important thing learners should be thinking about. Learning the syntax of a specific language is secondary to the fundamentals of logic and problem solving for coding, since those are a universal prerequisite for programming in ANY language.
Certain programming languages are better than others for different use cases. But at their core, all modern programming languages are simply a mode of communication between humans and computers. Proficient programmers can write code to fully utilize the language. But the real skill comes from knowing how to solve the problem at hand. This problem-solving ability is what sets programmers up for success in the long run.
If I had known this when I was starting to learn how to code, I would have prioritized my learning differently. That’s why the main piece of advice I like to share with new coders is this: becoming a great problem solver will enable you to become a great programmer.
Now let me share how I would approach learning to code in this way. You may be surprised to learn that you are already thinking like a programmer every day, whether or not you realize it.
Real-world example: The Bottle Problem
Let's start by looking at a beginner logic problem. I know "problem-solving" is an abstract concept to talk about in a blog, so let's visualize an example problem step-by-step.
Task:
Measure water into different quantities.
Materials:
- As much water as necessary.
- One 3-liter bottle.
- One 5-liter bottle.
Rules:
- You may fill and drain the bottles as often as necessary.
- You may pour the contents of one bottle into another.
- You cannot partially fill a bottle.
Now that we have the groundwork covered, grab a piece of paper or open a text file and write the step-by-step instructions for how you could measure out exactly 2 liters of water.
Remember: you can't fill a bottle halfway.
Answer:
If you start by filling the 5-liter bottle, all you need to do is fill the 3-liter bottle from the 5-liter bottle. Then, there will be exactly 2 liters left in the 5-liter bottle.
Too easy? Try working through the steps to measure out 1 liter. How about 4 liters? (Hint: both of these measurements can start by filling the 3-liter bottle.)
We start with this problem in our new Learn to Code series because it helps illustrate what it means to "think like a coder." In writing the steps to the bottle problem, you're already thinking like a coder. By fine-tuning your innate analytical skills, you can begin to solve increasingly complex problems.
Eventually, you can use a programming language to translate your solution into a format that a computer can understand. But solving the problem itself doesn't require any code. All it requires is your ability to think critically and solve the problem in a clear, incremental way. This is important to keep in mind — the most critical part of being a software developer isn't about knowing how to write code. It's about solving problems in ways that can be translated into code.
Start a free trial
Access over 500 courses on Programming, Cloud Computing, Data Science, and Machine Learning.
Bonus: You can check out the bottle problem and many more in our new Learn to Code courses with a free trial
How do I learn to think like a programmer?
Let’s take another real-world example.
When experienced software engineers are designing a streaming service (think Spotify or YouTube), one of the biggest hurdles they are confronted with is how to design for low latency. As a user, it is extremely annoying whenever you encounter a laggy stream. So, part of a good user experience is making sure that users can stream multimedia content even when their connection drops to 3G speeds (~3-5 megabits/second). When a user presses play, the media should ideally start to play within 200ms.
There are multiple ways that engineers can address this problem, some more elegant than others, but they are the most effective when implemented in tandem.
Reduce streaming quality: This may be the first thing to come to mind. If you reduce the quality, you reduce the file size, but this may not be the most user-centric solution.
Chunk and buffer downloads:
If you can break a file into pieces, the system can work on downloading one piece at a time. By downloading the first second or two of a file, you buy the system more time to buffer the subsequent chunks while the media streams.Cache queued material:
After the media that is currently streaming has finished downloading, the system can cache the next few files in the queue. This is particularly useful when it comes to streaming music in a system like Spotify or Apple Music. If a user skips a song or the internet connection drops, the next track is already cached and ready to play.
When we talk about how software engineers are paid to solve problems rather than write code, this is what we mean. Writing the code to put these solutions into practice takes technical skill, but improving a system given tight computational requirements takes ingenuity, creativity, and even artistry.
So, what should a learner do when embarking on a software engineering journey? In reality, it doesn’t start with writing simple programs. It starts by honing the problem-solving skills that you're already using every day. Then you can learn a programming language to translate those solutions into a format that computers can understand.
Analyze, plan, execute, and iterate
“Everyone in this country should learn to program a computer because it teaches you how to think.” - Steve Jobs
Thinking in a literal, procedural manner takes conscious effort. While we are used to thinking analytically, our brains are so good at pattern recognition and long-term memory that we can skip to (largely) accurate conclusions based on context or experience. Unfortunately, computers don't have access to the wealth of knowledge that lived experience provides. (Not yet, at least.)
Programming requires individuals to break down complex problems into smaller, more manageable parts. It also requires them to use logic and systematic thinking to solve those problems. Practicing and internalizing a step-by-step method to address one problem at a time — one line at a time, helps you develop new perspectives and ways of assessing complex tasks.
Where other beginner coding resources miss the mark
I don't know about you, but when I look around at a lot of other introductory coding content, I get discouraged.
I see many resources that start by getting learners coding and building basic programs as quickly as possible, which may seem like a good idea on the surface. But the reality is that this approach encourages rote memorization of commands, rather than explaining the logic behind the code, or supporting the problem-solving skills of the learner.
Writing a basic program (some simple arithmetic or printing your name) may be temporarily gratifying, but if you are just copying and pasting code, you won’t internalize the steps that need to be taken. In failing to do this, you ignore the "why" behind software engineers tackling problems in the way they do.
Immediately plunging students into the weeds of learning syntax isn't an ideal place for any beginner to start. It's not how university computer science programs approach teaching coding fundamentals, and it's definitely not how I would tell new coders to start.
As an educator, you want to enable students to come up with their own solutions to problems without too much help. If learners get stuck the moment the instructions go away, then they haven't acquired the necessary problem-solving skills.
Learn to code by becoming a problem solver
In our new Educative Learn to Code series, we start with simple logic puzzles (like the bottle problem above), and then gradually introduce flow charts, execution sheets, and other strategies that help coders efficiently solve problems with programming.
Our flexible online platform lets you learn at your own pace, wherever you are. We also provide clear guidance and milestones to help you build foundational skills in coding. Our courses are designed to help you develop the problem-solving skills needed for success in programming, whether you're just starting out or looking to take your skills to the next level.
Before you even type a single line of code, we'll make sure you're equipped with the tools to think like a programmer.
It's surprisingly common for beginners to feel overwhelmed at the prospect of learning how to code. Without clear guidance or a structured learning path, new learners may feel lost or unsure of where to focus their motivation. This is especially true for self-taught learners who are using online resources.
That’s why we created Educative Paths — to help learners accomplish Learn to Code and career goals. You can discover different developer specializations and start your journey to becoming a pro — one guided step at a time.
We currently offer language-specific paths for:
We also offer career-specific paths for:
By choosing Educative for your learning journey, you open the door to the wonderful world of software development. But by approaching your learning this way, you will internalize the fundamentals that set you up for success no matter the type of programming you choose to do.
Learning how to code is challenging, but it's also incredibly rewarding. So, do your future self a favor and establish the problem-solving foundation that will serve as the foundation for every single program you'll write for the rest of your career.
As always, happy learning!
This content originally appeared on DEV Community and was authored by Hunter Johnson
Hunter Johnson | Sciencx (2023-02-23T19:44:30+00:00) The 1 piece of coding advice I wish I had received. Retrieved from https://www.scien.cx/2023/02/23/the-1-piece-of-coding-advice-i-wish-i-had-received/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.