Hacker News new | ask | show | jobs
by Sealy 4773 days ago
I would always encourage any form of education, coding included.

The way I learned how to code was to play with pre-written pieces of code myself.

1. I would say to myself... I want to see if I can write a loop to print out a message.

2. Then I would go and google for the code.

3. Copy and paste it into my own file, and change it to do what I want.

I'm willing to bet that most of the hackers on HN learned how to code this way. That's why we call ourselves hackers right?

I guess this is similar to your approach but in a more controlled environment?

1 comments

You are right, we all do this. What is missing from this is feedback: how do I know if my design is good enough or what are its pros & cons? (Since often there is no absolute "good".) That is something I am trying to provide: showing two implementations of the same thing, discussing the advantages and disadvantages of each in relation to general coding and design principles. Thus it helps to learn not only how to do a particular task and how somebody else has solved it but also to think critically about design and the ability to relate to design principles. At least that is what I hope :)
That's so true, we hackers operate in a world where many different answers can be correct. However we can generally gauge if a solution is better or worse.

I guess you would need to come up with some sort of metric to measure how much 'better' one solution is over another. A crude example which I've seen is the number of lines. To me that just shows how elegant the code is, but as you know it does not necessarily mean it will execute faster.