How do I think like a programmer?
I'm a network engineer who has dabbled in Python for some automation, PHP for random fixes on the many php sites I throw on my LAMP, bash for, well, various systems stuffs.
I recently got into Corona SDK and Lua and am just trying to release a project. My biggest frustration comes from not the syntax or IDE, but figuring out how and where to write and call functions. I feel like my brain doesnt think like a programmer, so I am constantly hitting a wall and starting over.
Any advice?
14 comments
[ 4.2 ms ] story [ 46.1 ms ] threadI have heard that going through SICP can help you better wrap your head around functional decomposition and that sort of thing, but I haven't gone through yet it myself.
I am slowly chiseling away at my 10k hours :)
Knowing what function to call and where in a big, unfamiliar program, requires cunning: more so than in your own program where you know everything.
Find out if the program has a regression test suite, and learn how to run it. Then when you make changes, execute the suite. If anything breaks because of your change, find out why; by answering the question "I cannot do it this way because ..." you will quickly get some fairly deep insights into the program.
I spend a lot of time on git reading code, shamelessly stealing function and seeing how they work in my code. I am glad that there is benefit to what I am doing. Thank you for the advice!
Besides that, programming can be just like painting. Each of us has its own style and, even if there are some common patterns e.g.: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93cont..., generally there aren't really written rules on how and where to write and call functions. Just try, eventually learn some patterns and then just do what you feel is better for your own project following your own style.
Once you've done this everything will be easier and doing things will be awesome. In the end, you will be even capable of jumping from a language to another on the fly. Don't be frustrated, keep trying and have fun! ;)
Here's a good example:
My friend has a business selling essential oils (Eucalyptus, Lavender, Sandalwood) on Amazon. This turns out to be a pretty decent business for one simple freakonomics'ish reason I believe. Let me illustrate:
You can sell 10ML of oil:
http://www.amazon.com/Lavender-100%25-Therapeutic-Grade-Esse...
For nearly the same price as you can sell 3 times the amount:
http://www.amazon.com/Woolzies-Lavender-100%25-Pure-Essentia...
I think the reason for this discrepancy is people can't do conversions between milliliters and ounces in their head, and since they can't hold the oils in their hands and only have a picture for reference, they use the price itself to determine the value of what they're getting.
Now back to thinking like a programmer: Upon hearing this, a programmer's first instinct wouldn't be to start a competing line of business but rather would be to come up with a systematic way of scouring Amazon's entire inventory for a multitude of such arbitrage opportunities. He'd branch out to using weight in addition to volume.
In addition to exploring the details, programming gives you practice in seeing the big picture and branching out at all levels of the system.
http://www.youtube.com/watch?v=4nhFqf_46ZQ