Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,486 members, 7,808,783 topics. Date: Thursday, 25 April 2024 at 04:52 PM

Learn To Code By Breaking Someone Else's Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Learn To Code By Breaking Someone Else's Code (1228 Views)

How To Code Your Own Personal Assistant In Python / Wisdom To Code By / Learn To Code By Being Coached By An Experienced Developer For Free (2) (3) (4)

(1) (Reply) (Go Down)

Learn To Code By Breaking Someone Else's Code by adewasco2k(m): 11:47pm On Oct 12, 2013

One of the best techniques to learn to code is to reverse engineer existing code. Code training company Treehouse explains how to "break" code to better understand how it works.

Nick Pettit gives an example on the Treehouse blog of wanting to learn about 3D programming in the browser and testing a line of a Javascript script, Three.js:

The following is a code example that uses three.js to create a light:

    var light = new THREE.PointLight(0xffffff);
light.position.set(-100,200,100);
scene.add(light);


If you have some programming experience, you might be able to read this and figure out most of what’s happening here. If there are any blanks or assumptions you’re unsure about, you can test them with the following techniques:

1. Delete one line at a time to see if it’s necessary for your goals.
2. Delete one line at a time to better understand its function. Even if you think you know what a line does, try deleting it anyway to test your assumptions.
3. Change variables and function arguments to see if you can manipulate them in a way that matches your mental model.
4. Swap the order of various lines to see if things can be done “out of order” or if there’s some significance to the sequence of operations.

As you test each line, you’ll start to build a mental model and make corrections to other assumptions you made previously. Soon, the whole picture will start to make sense.

The key is to break one thing at a time and see what changes so you can understand the relationship between all the parts in the code.

Self-taught programmers likely already know the great value of reverse engineering others' code, but as Treehouse points out, this strategy doesn't get enough emphasis. Thanks to generously shared open source code, you can learn just about anything by breaking it.

Source
Re: Learn To Code By Breaking Someone Else's Code by talk2hb1(m): 1:41am On Oct 13, 2013

1. Delete one line at a time to see if it’s necessary for your goals.
2. Delete one line at a time to better understand its function. Even if you think you know what a line does, try deleting it anyway to test your assumptions.
Instead of delete, why not comment Commenting does the same thing.
Never mind, just thinking One of my Coding bad habit not wanting to let go even of source code.
Love this keep it up.
Re: Learn To Code By Breaking Someone Else's Code by CODEEATER(m): 9:32am On Oct 13, 2013
Looking for where I can learn threejs
Re: Learn To Code By Breaking Someone Else's Code by Nobody: 2:45pm On Oct 18, 2013
I learnt a lot doing this /**/ and this // You however have to keep tabs and remember which part you commented out, else...

(1) (Reply)

Who Has Seun Osewa's Contact Info / SEO Experts!! / In Need Of A Programmer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.