Computer Science Canada Why can't programmers...program? |
Author: | Insectoid [ Wed Mar 10, 2010 9:46 pm ] | ||
Post subject: | Why can't programmers...program? | ||
Why can't Programmers...program? Sure, it's a couple years old, but the author confirmed its continued relevance in his most recent blog post. I had to prove to myself that I'm not one of those mentioned, so here's my Ruby solution to the pre-interview 'test':
This took <10 minutes, including the time I took to look up how elsif structures work in Ruby (since I haven't used those in a while, oddly). |
Author: | USEC_OFFICER [ Thu Mar 11, 2010 12:33 pm ] | ||
Post subject: | RE:Why can\'t programmers...program? | ||
Really? They can't even do the FizzBuzz program? Even though it has been a while since I used C++, I'm sure I could do it in under 10 minutes. (Too lazy to try.) EDIT: Here it is in Turing, took me a minute or two:
|
Author: | chrisbrown [ Thu Mar 11, 2010 1:20 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
The purpoose of this exercise isn't to see if you can write the program or even demonstrate a working knowledge of a particular language, it is to show that you can produce a working program from a given specification. I think it is safe to assume that most members here would call this a trivial problem. This article is trying to point out that there are a large number of people who, for whatever reason, think they are good programmers, but aren't. Personally (because I've seen way too much of this), I think this is because they spend hours on the tweak-test-repeat cycle until they stumble onto the desired behaviour. That's fine for high school, but beyond that, you need to be able to look at a program and at least get a general idea of problem spots, rather than change one thing and hope your problem goes away, and try again if it doesn't. |
Author: | Zren [ Thu Mar 11, 2010 3:15 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
PS: The multiple of 3 and 5 is the same as multiples of 15. I've noticed people tend to do exactly as the problem says (not that it bad really), but don't notice simple math rounding or slightly more efficient code. |
Author: | Insectoid [ Thu Mar 11, 2010 4:09 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Well, if I bothered to think about this I'd realize that Zren, however I wasn't at school at the time so I was lacking in motivation. My grade 12 CS class was supposed to be focused on efficiency, but instead we wasted time learning yet another useless language (this one Flash) so I dunno how to make it more efficient beyond replacing n%5 && n%3 with n%15. |
Author: | USEC_OFFICER [ Thu Mar 11, 2010 4:20 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
You really can't make a simple program like this one more efficient than it already is. |
Author: | andrew. [ Thu Mar 11, 2010 4:34 pm ] | ||
Post subject: | RE:Why can\'t programmers...program? | ||
Wow, that's shocking. I did it myself in under 2 minutes.
|
Author: | rdrake [ Thu Mar 11, 2010 6:36 pm ] | ||
Post subject: | Re: Why can't programmers...program? | ||
Needs nicer Ruby.
|
Author: | Insectoid [ Thu Mar 11, 2010 6:56 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Meh, I can never decide if Ruby wants brackets or not, but what harm is there in using them? Switching between Java, Flash, Turing and Java often confuses me. Anyway, we all know every one of us can do this program, but let's discuss the actual issue the blog was addressing. |
Author: | DtY [ Thu Mar 11, 2010 7:20 pm ] | ||
Post subject: | RE:Why can\'t programmers...program? | ||
I guess this topic is just going to be about posting the solution over and over in different languages, so here's another solution in Python:
Granted, I probably wouldn't go for that if all I had was paper, and could not actually test it. |
Author: | andrew. [ Thu Mar 11, 2010 8:04 pm ] | ||
Post subject: | Re: RE:Why can\'t programmers...program? | ||
DtY @ Thu Mar 11, 2010 7:20 pm wrote: I guess this topic is just going to be about posting the solution over and over in different languages, so here's another solution in Python:
Never thought of doing it like that. I guess that proves I'm still a Python n00b.
Granted, I probably wouldn't go for that if all I had was paper, and could not actually test it. |
Author: | USEC_OFFICER [ Thu Mar 11, 2010 8:08 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Now that we do know that in fact, we can all do the program, can we talk about the blog? And why most graduates can't do this in 10-15 minutes? |
Author: | DtY [ Thu Mar 11, 2010 8:27 pm ] |
Post subject: | Re: RE:Why can\'t programmers...program? |
USEC_OFFICER @ Thu Mar 11, 2010 8:08 pm wrote: Now that we do know that in fact, we can all do the program, can we talk about the blog? And why most graduates can't do this in 10-15 minutes? It's probably largely how CS is taught. Last year, when we were learning Turing, I felt like there was a lot of this is how you do this, and not so much this is why you want to do this, and this is how it works with that. I don't imagine this would continue so much into a university level, and the teacher I have this year does a better job with the why. What I mean can be summed up pretty well (by changing the context) with this passage out of Nineteen Eighty-Four:
Quote: He took up his pen again and wrote:
I understand HOW: I do not understand WHY. This seems to be, in my experience anyway, the problem with a lot of elementary and high school classes. I went to a French immersion school until less than a month into grade six, when I moved and started going to an English school. Going through non immersion French classes until grade nine, using grade three to four textbooks, it amazed me that a lot of the class could not string together complete sentences and carry a conversation in French, that was something the majority of my class could do after kindergarden. It was not their fault though (of course, it didn't help that no one, not even myself wanted to be there), most classes were learning verb conjugations and exceptions, and not actually talking in French. It's funny, though, you can ask nearly anyone who is a native English speaker to conjugate 'to be', and they'll stumble over it, or not get it at all, but they can use it in any sentence just fine, it's because you don't learn a new language by memorizing verb exceptions, but there is such an emphasis on that for some reason. --- andrew: Don't worry, no one who hasn't spent time using functional languages would think that's a good idea to use ![]() |
Author: | andrew. [ Thu Mar 11, 2010 10:32 pm ] |
Post subject: | Re: RE:Why can\'t programmers...program? |
DtY @ Thu Mar 11, 2010 8:27 pm wrote: I went to a French immersion school until less than a month into grade six, when I moved and started going to an English school. Going through non immersion French classes until grade nine, using grade three to four textbooks, it amazed me that a lot of the class could not string together complete sentences and carry a conversation in French, that was something the majority of my class could do after kindergarden. It was not their fault though (of course, it didn't help that no one, not even myself wanted to be there), most classes were learning verb conjugations and exceptions, and not actually talking in French. It's funny, though, you can ask nearly anyone who is a native English speaker to conjugate 'to be', and they'll stumble over it, or not get it at all, but they can use it in any sentence just fine, it's because you don't learn a new language by memorizing verb exceptions, but there is such an emphasis on that for some reason. That's an amazing point. I've never really thought about the way language is taught (mostly because I don't like language). But now that you have me thinking about it, Spanish is also taught this way and I'm sure German, Latin, and other languages are too. I completely agree with you that we should learn to speak fluently first, and not to focus too much on things like conjugations. That way students will have a better understanding of the language and the way it works.
I see how you are linking this to a programming language. The students should learn the substance of the language and how it works instead of piecing together half-formed programs using methods that they memorized. I think this is a great point and I completely concur with it. P.S. How do you conjugate "to be" in English? |
Author: | Alexmula [ Thu Mar 11, 2010 10:37 pm ] |
Post subject: | Re: RE:Why can\'t programmers...program? |
andrew. @ Thu Mar 11, 2010 10:32 pm wrote: P.S. How do you conjugate "to be" in English? I am, you are, he is, etc ![]() |
Author: | DtY [ Thu Mar 11, 2010 10:39 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Also relevant, there was a blog post on the CompSci.ca blog about how CS isn't about memorizing, but that's how a lot of people learn it. "P.S. How do you conjugate "to be" in English?" That's a good question :/ I think it is something like I am You are He is She is They are We are |
Author: | andrew. [ Thu Mar 11, 2010 10:39 pm ] |
Post subject: | Re: RE:Why can\'t programmers...program? |
Alexmula @ Thu Mar 11, 2010 10:37 pm wrote: andrew. @ Thu Mar 11, 2010 10:32 pm wrote: P.S. How do you conjugate "to be" in English? I am, you are, he is, etc ![]() ![]() |
Author: | DtY [ Thu Mar 11, 2010 10:42 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Aha, that was my point, everyone knows it, but most native speakers don't know it. |
Author: | Insectoid [ Thu Mar 11, 2010 11:12 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
Have you ever noticed that Europeans are very good at learning second or third or more languages? Almost all of my cousins are fluent in the 2 languages Holland uses, as well as German, French, and English. In Canada and the states, most people struggle to learn even a single extra language (French and Spanish respectively). I don't know if it's the teaching methods or if it's just 'cause European TV is mostly English programming, or if it's 'cause they're surrounded by dozens of small countries that each speak a different language whereas we're used to everyone speaking english. With the exception of those nuts in Quebec and Mexico. |
Author: | TheGuardian001 [ Fri Mar 12, 2010 12:12 am ] |
Post subject: | Re: Why can't programmers...program? |
Probably more the surrounded by other languages thing. As much as good teaching plays a role in learning a language, what really helps you to be able to speak it is exposure. French immersion programs work well because on top of learning the rules, you also learn the practical application of the language. Core French fails because it only tells you how to use the language without actually making you use it too much. The same problem with your average french course is present in Comp Sci. Taking the courses will only get you so far. Sure, they'll provide a good framework to build from, but if you want to really know how to use a language, you have to actively use it. For example this guy(linky) wrote a Tetris game, in C, using only knowledge found in Borland reference books that came with his computer. He learned to write C (admittedly very poor C) entirely through exposure. If I had to guess, I'd say that there are probably quite a few Comp Sci students out there who never program on their own time. Their courses might have given them all the fundamentals of a programming, but when it comes to how or when to use the fundamentals, they're clueless. |
Author: | Clayton [ Fri Mar 12, 2010 2:41 am ] | ||
Post subject: | RE:Why can\'t programmers...program? | ||
A Java solution:
|
Author: | chrisbrown [ Fri Mar 12, 2010 3:28 am ] | ||
Post subject: | Re: Why can't programmers...program? | ||
Representing:
Edit: I should add that this is one of the dirtier solutions... there are, of course, much more elegant and easily understood solutions, I just wanted to wrap it up into a single expression. |
Author: | Insectoid [ Fri Mar 12, 2010 11:20 am ] |
Post subject: | RE:Why can\'t programmers...program? |
I get it guys, you all know how to solve this simple problem. Why not stop wasting my time and yours and post something more than 'here's my solution to a dirt simple problem but I'm not gonna post substance here'. How many times have I said this now? Great, you guys are forcing ME to post without substance. |
Author: | USEC_OFFICER [ Fri Mar 12, 2010 12:05 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
I thought posting without subtance was my job! I agree with TheGuardian001. Programming on your own free time is important. That way you can explore the skills that need work more. |
Author: | Prabhakar Ragde [ Fri Mar 12, 2010 1:26 pm ] | ||||
Post subject: | Re: Why can't programmers...program? | ||||
Too much work on the Scheme solution, methodoxx.
Or, to avoid lists entirely,
|
Author: | Insectoid [ Fri Mar 12, 2010 1:38 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
*sigh* I give up. |
Author: | TheGuardian001 [ Fri Mar 12, 2010 1:51 pm ] |
Post subject: | Re: Why can't programmers...program? |
Apparently all the programmers here can do nothing but program... |
Author: | chrisbrown [ Fri Mar 12, 2010 2:09 pm ] |
Post subject: | RE:Why can\'t programmers...program? |
@PR: Wow, I'm gonna go crawl into my hole now. I knew there had to be a better way. I guess I should stop coding drunk. On the plus side, I didn't know build-list consumed a function, that's going to be handy. @Insectoid, programmers are strange, they (we?) really only want to know that we can solve the given problem. When I read an article like that, I think, "Oh look, it's high school all over again where apparently only 1% of people can write code." To be honest, I've put in enough time helping others with simple programs, now I just want to code. |
Author: | jbking [ Fri Mar 12, 2010 3:45 pm ] |
Post subject: | Re: Why can't programmers...program? |
Coming up with the code is only part of the battle here, though. Being able to explain why the code is as good as it is and handle possible criticisms of a solution are other factors. |
Author: | Prabhakar Ragde [ Fri Mar 12, 2010 4:19 pm ] |
Post subject: | Re: Why can't programmers...program? |
methodoxx: It's okay, what you did was reasonable if you wanted to avoid multiple functions or explicit recursion and you didn't know about build-list. And I did note the time on your post. Insectoid: You might have kept the discussion more focussed if you hadn't posted your own solution (but maybe not, this is the Internet after all). Why can't Johnny program? (And it is Johnny, not Jill, alas.) There are plenty of places in this world where people are encouraged to get something done in a blind fashion rather than understand what they are doing so that they can reliably get a variety of things done. Or if not encouraged, at least not discouraged. You would think that a university CS course would not be one of those places, but (a) the diagnosis and assessment tools I can use with the resources I have are inadequate to encourage the right behaviour, and (b) if they were adequate and found that, say, half the class needed to repeat in order to come up to standards, I would come under considerable pressure to let most of them through anyway. In a credit system, the responsibility to ensure quality is diffused. The one person who has the most responsibility (and the most to lose) is the person being educated. But how to get them to realize that and act on it appropriately? |
Author: | Prabhakar Ragde [ Fri Mar 12, 2010 5:28 pm ] | ||
Post subject: | Re: Why can't programmers...program? | ||
At the risk of further annoying Insectoid... this one is fun. Haskell, of course.
|
Author: | Turing_Gamer [ Mon Mar 22, 2010 7:26 am ] |
Post subject: | RE:Why can\'t programmers...program? |
I agree with you TheGuardian. Apparently that is all we can bascially do. |
Author: | USEC_OFFICER [ Mon Mar 22, 2010 11:37 am ] |
Post subject: | RE:Why can\'t programmers...program? |
You meantion (Can't spell) a test like this, then everybody wants to prove that they can do it. |