Skip to main content

Programming vs Learning to Program

This is a multi-faceted topic, I want to look at one aspect in this post: effort vs. efficiency.

After creating a Caesar cipher in Ruby a few days ago, I looked at some other student's solutions. Some students were clearly experienced programmers- their code was 5 lines of densely packed recursive algorithms. 


At first I was discouraged and thought "What can't I do that?", and "Why doesn't my code look that?".  Then I reconsidered.


My solution to the Caesar Cipher represents my single handed efforts at solving a problem. The solution was based on the 4 weeks of experience I have with Ruby. 
Sure, there are built in methods that would have accomplished the task more elegantly (like the .modulo method).
 Sure, I could refactor my code making it shorter and making it run faster.

But, until I learn those methods and refactoring techniques, using them because someone else told me to would short circuit my learning. When I do search on StackExchange  for some help, I find students like myself asking for help on everything. It seems as though they have made no effort to solve the problem or find the answer themselves before asking someone else for the answer. 


Does this matter? The real world of programming (from what I hear) is much more cooperative. If you're stuck on something, you ask your co-workers or post a question on StackExchange. In other words, you use other people to help you solve problems. If I were writing a Caesar cipher program at work (not that they would need one), I would first check to see if it had been done already. If it had, I would look over the code, make a few tweaks, and voila.

The problems comes when you adopt this behaviour too early in your learning. Struggling on your own forces you to think carefully through problems, to try lots of different methods, to read documentation carefully. It forces you to develop the skills that you won't be able to rely on others for at work, namely, the ability to deal with frustration and the ability to think carefully on your own. 
Even your co-workers will tire of helping you (don't be a 'help vampire').

To return to the theme of this post, when learning to program effort is more important than efficiency. 





Comments

Popular posts from this blog

CodeSchool vs Codecademy(or 'How socket inherits event listening methods and implements asynchronicity')

In this review I'm going to focus on the pedagogy that I see evident in some CodeSchool courses and compare them to  Codecademy. By pedagogy, I mean: 'How does CodeSchool teach?' and ' Does it do a good job of teaching?'. I'm going to argue that despite high quality videos, colourful web pages, and often ssspppeeeeeakkkiiiing...rrrreeally...slowly..., CodeSchool's pedagogy is inferior to that of Codecademy. There are many fantastic resources for learning to code on the web, and CodeSchool is one of them. So far I have completed courses in Ruby, Rails, Javascript, HTML/CSS, Jquery and Git on CodeSchool. The courses have all included high quality videos and colourful, interactive exercises- as well as  massive  pdf files of the slides ( the files take more than a minute to load on my machine .) The question is: does the higher production value mean better educational quality? The 'Try' courses on CodeSchool(such as Try Ruby and Try jQuery) are f...

Algorithm Analysis - 1

Currently, I'm learning to perform algorithm analysis using Big-O notation. In one resource I found the following problem: You just dropped a box of glass toys and  n  toys in the box broke in half. You'd like to match the halves of the toys so that you could glue them together, but the only way to tell whether two halves belonged to one toy is to physically pick up the two pieces and try to fit them together. Express how long this matching process will take in terms of  n . The answer given is n^2 (n squared) with the following explanation:  You have to compare every piece with every other piece. If you have 1 toy and it breaks in half, you have 1 comparison to make. If you have 2 toys and they both break in half there are 4 pieces and you have to do 6 comparisons. If you have 3 toys, there are 6 pieces and you have to do 15 comparisons. If you have  N/2  toys, you have  N  pieces and you have to do N-1 + N-2 + N-3 + ... + 1 =(N)(N-1)/2...

Ruby, RSpec, Linux and Relational Algebra (or "What I'm doing this Christmas")

Last week was challenging- I'm beginning to appreciate the need for a programming buddy.  So far, I haven't found a Ruby IDE that helps with missing brackets or illegal syntax. This means hours spent looking for errors which more experience (or an IDE) would have solved in an instant. I've spent a lot of time on Stack Exchange looking for solutions to problems that many have already had- so far I haven't had to post a single new question (though it's evident that many people post duplicate questions, not having looked for a solution first). I spent longer on the Ruby project than anticipated, BUT I really enjoyed learning about Behaviour Driven Development. Thinking of tests in RSpec and then watching my Ruby script pass (eventually) was like passing an exam (though  one I had written myself). This week I'll be starting Rails-after I complete the CodeSchool Rails courses I'll go on to their RSpec course. Partly for the geek cred, partly out of curiosit...