TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do you learn by doing?

58 pointsby lignuxover 8 years ago
Basically the title. I know the best way to learn some new programming language is by making something i am interested in, but every time i try this approach i feel my code is &quot;hacked&quot; together for example: I need something, i google how to do that something in X language, read the code and try to understand it and then just copy it.<p>After a while i feel like i have learned nothing or just so little that i lose interest.<p>Am i doing this wrong? What is your approach for learning something new?

17 comments

ChicagoBoy11over 8 years ago
I would invert your process. The idea that the best way to learn is by doing is correct; however, if you just decide on &quot;I want to make my own Facebook&quot; when your level of knowledge is at &quot;Hello World,&quot; you are going to have a bad time.<p>As a learner&#x2F;worker&#x2F;human being, the ideal place to be is what is called a state of &quot;flow&quot;, where the challenges you have in front of you are neither too trivial but also not too insurmountable. You want something to challenge you but also not something that will leave you completely lost.<p>So, my advice is to just flip your process. Take whatever you are learning -- be it through a book, a tutorial you are following, etc. -- and then once you feel confident you&#x27;ve learned some discrete new chunk of skill, try making something on your own that leverages it. But just something that you feel could be accomplished with roughly the skillset which you now believe you have. The best projects follow the mold of &quot;I&#x27;m pretty sure I could do [x] now, but I&#x27;m not sure.&quot;<p>For instance, if you are learning some framework like Angular, a bad place to start would be &quot;I want to make a real-time chat app&quot;. But as you are working through a tutorial, once you learn how to just literally put a stateless component on the screen, you might get to a stage where you feel comfortable just putting another one on the screen that does something slightly differently. Sweet, you got that down. Then, later on, you&#x27;ll be introduced to managing routes; so if the tutorial you are following is a simple app that shows phones and details of the phones, make one that can show books and a collection of reviews of the books and maybe a link to where you could buy it on Amazon. And on and on and on...<p>In this way, you are always checking for understanding by doing and can figure out where your knowledge is poor, but never dabbling into things that you have no proper mental scaffolding for which just turns into copying and pasting code you don&#x27;t understand.
评论 #13052472 未加载
评论 #13050532 未加载
bjourneover 8 years ago
&gt; read the code and try to understand it and then just copy it.<p>That&#x27;s not learning by <i>doing</i> that&#x27;s learning by <i>copying</i>. :) I don&#x27;t think learning by copying works which is why your approach is flawed.<p>Next time try this instead. Google it, find some code, read it and try to understand it like you do now. Then <i>don&#x27;t copy it</i>. Instead open it in a text editor window and in another you rewrite the code. If you don&#x27;t know how to rewrite it, just do it character by character.<p>Now you might say &quot;that&#x27;s just a slower form of copy-paste!&quot; but no, it is not. After a few times trying this, you will see why it isn&#x27;t. It is the method I use and it works for me.
评论 #13058925 未加载
ci5erover 8 years ago
For myself, decades ago, my learn-as-you-go project was a distributed rendering system. Here&#x27;s what worked about it:<p><pre><code> - Ray-tracing (for example) is easy to reason about in an object oriented fashion (this was before functional was all the rage) - You&#x27;re never done. There are always new lighting models, surface models (shaders), geometries, optimizers to add - Each module, pretty quickly, gives you visible results. - Because it&#x27;s modular, there&#x27;s lots of opportunity for incremental refactoring of modules and for re-implementation of modules in new languages - It could be part of a (much) larger ecosystem. Maybe you want to add water - oceans are fun. To add robot simulators, you need a physics engine. To which you can add ML to generate and optimize controllers to have the robot hit goals. etc. etc. </code></pre> In this case, I had to learn numerical methods (for both rigid-body physics and monte carlo), various rendering techniques, how to implement shading languages, distributed algorithms, managing distributed clusters, FPGAs (before GPUs were cheaply available), etc., etc.<p>I&#x27;m not suggesting a rendering test-bed specifically, but unbounded problems that can be modularized where you always have a list of &quot;next modules&quot; is one way to have an ever-green project you are always adding things too -- sometimes (but not necessarily) in new languages, using new development paradigms. For me, agent-based computational economics, various physics-related simulations (in general), machine-learning around robotics (control systems) and that rendering test-bed were my &quot;domains&quot; of experimentation. For you, it could well be just about anything else.
Johnny_Brahmsover 8 years ago
My son, a classical musician, got a lot better at maths by solving (and understanding) the first 400 project euler problems over 2 years.<p>I just pointed him to the relevant passages in my old text books, and he more or less did it himself. I helped him with one of the harder ones he had been banging his head against, but that was more of a language problem than not understanding.<p>I am pretty darn impressed.
评论 #13052226 未加载
shaknaover 8 years ago
I don&#x27;t make a project I&#x27;m interested in.<p>I make the same project every time I pick up a new language.<p>It lets me pick up the differences quickly, when all the logic basically stays the same.
评论 #13054208 未加载
brudgersover 8 years ago
If it were natural language rather than a programming language, ability to write something that works after a few hours study would be a significant accomplishment. Non-trivial understanding of any programming language simply takes time.<p>Anyway, most code is just hacked together because writing working code is hard.<p><a href="http:&#x2F;&#x2F;norvig.com&#x2F;21-days.html" rel="nofollow">http:&#x2F;&#x2F;norvig.com&#x2F;21-days.html</a>
andrei_says_over 8 years ago
I learned ruby by doing simple exercises. Basically tinkering and getting a feel of how things work.<p>Think of learning as an interactive loop: you try something and see the outcome. Like, if you&#x27;re learning to throw a baseball, you try a million of small adjustments until your body-mind gets a feel of the movement and the associated outcome (read The Inner Game Of Tennis).<p>Similarly, when programming, your mind starts thinking and imagining in the constructs it experienced and internalized. Getting a feel of these constructs and patterns is the result of using them enough times to build things or solve puzzles.<p>If you want to get a feel of ruby, I recommend going through the exercises here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;JoshCheek&#x2F;ruby-kickstart" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;JoshCheek&#x2F;ruby-kickstart</a><p>The videos are optional, just download the repo, set up ruby and rspec, open your favorite text editor and you&#x27;re set.
rkvover 8 years ago
- Look at &quot;skeleton&quot; or &quot;boilerplate&quot; projects on GitHub. Don&#x27;t copy the first one you find, make sure you review a handful and study how people are using the language and eventually make your own. Bonus if the project is from a contributor of the language.<p>- Some languages and frameworks have a &quot;best practices&quot; guide.<p>- RTFM!<p>- Iterate. Your first attempt will always feel hacky. Revisit it after more studying and practice.
itamarstover 8 years ago
The problem is that creating a new project from scratch is <i>not</i> the best way to learn a new language.<p>Here&#x27;s how I would do it:<p>1. Skim an introductory book. This will give you an overview of language features, syntax and libraries. And when you get stuck on something confusing you&#x27;ll have some vague memory of &quot;oh, chapter 7 covered that feature, let me look it up.&quot;<p>2. Read some well-commented, good code in the language in a problem domain your understand. E.g. if you&#x27;re backend web developer find a web framework which is similar to one you&#x27;ve used in a language you know.<p>3. Modify some existing code in the language. This means you&#x27;ll be able to tell if the code runs, you&#x27;ll have examples to work off of, a testing setup you can hook in to, and so on.<p>4. Write some new code in a highly structured way where there are pre-existing examples for the task you&#x27;re doing. E.g. use a high-level framework, or write a middleware plugin.<p>5. After all that you might be ready to make something completely from scratch.
samayshamdasaniover 8 years ago
I completely understand where you are coming from. Often, I do the same. However, I feel like copying the code by typing it after understanding what every single line means is when you&#x27;re actually learning. I built a site to teach people to code this way (<a href="https:&#x2F;&#x2F;enlight.ml" rel="nofollow">https:&#x2F;&#x2F;enlight.ml</a>). If you want to learn by doing (it is one of the best ways to learn), you must understand and be able to reproduce it before copying it down.
eb0laover 8 years ago
Try disconnecting from the internet.<p>I learnt a lot of python because I disconnected the wifi and used offline documentation.<p>Online documentation &#x2F; sites like stackoverflow are great when you need information with <i>very</i> narrow scope. Great for getting the job done; but not for learning &#x2F; understanding &#x2F; memory retention.<p>When you need to learn something you have to see the whole picture. For that there is nothing better than books or offline documentation.
salukiover 8 years ago
First off do you know the basics? HTML&#x2F;CSS and Ruby or PHP are you creating web apps in an existing framework or just getting started.<p>If you&#x27;re just getting started it helps a lot to have a handle on html&#x2F;css, javascript, jQuery and ruby&#x2F;PHP before diving in to a framework for web app related stuff.<p>So if you need to take some time and learn HTML&#x2F;CSS and some javascript&#x2F;jQuery.<p>I would learn languages in this order HTML&#x2F;CSS, javascript, jQuery, PHP&#x2F;MySQL, then Rails or Laravel, then Vue,React, etc. if you&#x27;re interested in web apps.<p>My first go at learning Rails was too early and I had a difficult time and gave up.<p>After creating a web app from scratch, writing a basic login, CRUD and learning the inner workings of a basic web application I gave rails another go and it clicked and went smoothly.<p>The first time I didn&#x27;t understand the basics of a web application and had a difficult time knowing what rails was doing or what to do next.<p>So I think it depends on what level you are at.<p>As far as cutting and pasting, when you&#x27;re learning cutting and pasting is fine, even as an advanced programmer you&#x27;re always going to be learning and looking at what others have done as a starting point.<p>When you cut and paste you&#x27;ll usually be modifying it to make it do what you want. So take a little extra time and research what it&#x27;s doing till you understand it so you can use it again and understand what it does&#x2F;can&#x2F;can not do.<p>Choose something you&#x27;ll use not a straight copy paste tutorial. Choose something with the basics of a web application, you can follow tutorials for that but add in something unique that you&#x27;ll have to create from scratch. This is where the learning takes place.<p>So maybe an app you can login to and track your lego star wars collection, or an app you and your friends can log in to and have your own private twitter or social network. Maybe something that connects to an api of a service you use. Sign up for Stripe and create something with a billing&#x2F;subscription component.<p>Just build one part of it at a time. Set a goal, this evening or this weekend I&#x27;m going to build this part and have it up and running.<p>Good luck, enjoy learning something new, Happy Holidays.
aisoftengover 8 years ago
Stop copying code. That&#x27;s lazy and ineffective. If that hasn&#x27;t occurred to you, perhaps evaluate your work ethic.<p>Would you learn math by copying and pasting from a solutions manual? Would you learn to write fiction by copy pasting others&#x27; short stories?<p>You won&#x27;t learn to write code without writing code.
PaulHouleover 8 years ago
Learning by doing and reading books go together like peanut butter and jelly.
评论 #13049759 未加载
demolishover 8 years ago
tutorials never worked for me, far too boring<p>was much easier to just find existing codebases and tinker with some functionality of them to learn, while asking those more experienced to clarify anything i couldn&#x27;t figure out with a bit of trial and error&#x2F;looking up usage of similar code elsewhere within the codebase<p>personally, i learned c++&#x2F;lua (though im not by any means &#x27;advanced&#x27; in them) from an mmo server emulator since it was easy to see how gameplay was affected and compare expected vs intended results<p>also im barely awake rn so this comment probably makes zero sense
krivxover 8 years ago
It doesn&#x27;t sound like you are iterating on this. Look at the code you are not happy with. What is wrong? Can you fix it? If so, try to do those things next time. Don&#x27;t stop the process.
adamnemecekover 8 years ago
Read code for popular open source projects written in the language.
评论 #13050569 未加载