posts tagged with the keyword ‘programming’


Copying and Pasting

I saw many friends share this amusing image of a fake O’Reilly book titled “Copying and Pasting from Stack Overflow”, and if you’re not in on the joke, Stack Overflow is a web site where you can post programming questions and get answers to those questions. It’s also a site (like many others) where people who are not sure what they are doing grab bits of code from when they are not 100% sure what they are doing. (And if you don’t know about O’Reilly, they publish technical books, many about programming.)

This is the first semester I’ve taught a class that includes programming. I was upfront with students about how I’ve learned to write code over the years, and that includes looking at examples, using existing code, and (eventually) reusing my own code. I didn’t force them to type out each line of an Arduino sketch because I didn’t think it was completely necessary. They already know how to type, and once I showed them how to hit the compile button, they learned about syntax errors. Occasionally in class I’d demo things by writing code on the fly and inviting them to type up what I just typed, and to play around with the values, add more lines, etc. (I showed them the “Examples” menu early on, which contains plenty of useful code to get started with.)

Here’s something that may be news to some readers – I’m not a great programmer. I’m a hacker, and I can write enough code to get by, but more importantly I can find enough sample code and examples and tutorials to write the code that I need to do what I want to do. I think that’s the key to things.

If you’ve ever heard the expression “To be a great writer, you need to be a great reader” then perhaps this also applies to programming, and reading code is an important part of writing code.

Now, with all that said, I still expect students to learn some of the basics of writing code and understanding it. If at the end of the semester all they’ve done is copied & pasted code that someone else wrote, and by some miracle it compiles and runs and works for their project, that’s still sort of good, but not quite as good as having a basic understanding of what exactly those lines of code are doing.

In the meantime, keep copying code, and pasting code, and while you’re at it, try to read it and understand it.


BarCampMadison This is a session by Dan from MadCamp (aka BarCampMadison the 4th) titled “Functional Programming: Why Should You Care?”

You can also download an MP3 file if you’d like. (And for our freedom loving friends, enjoy an Ogg file.)

Also, if you want to get all of the audio automagically downloaded podcasting style, subscribe to the feed.


I stand here today not to condemn Perl, but to defend it… Perl

And when I say “Perl” I want you to feel free to substitute any other language you see fit… Visual Basic, Fortran, Lisp, COBOL, Smalltalk, or even… Java.

I was given a programming assignment this week. Given a list of 2000 names, I was to provide 400 names randomly. (Yes, this was for work, and was a real-world assignment, not just some exercise.) I proceeded to open my ~/scripts folder, which contains well over 1,000 Perl scripts, and grabbed some existing code, and wrote some new code, and ran a few tests, and quickly had the list of 400 names.

I used Perl because it worked for me. I probably could have written in it PHP (as it’s another language I am pretty comfortable with) but since I’m more familiar with Perl, and have done very similar thing before with Perl, and had a gigantic library (nearly 15 years worth) of Perl scripts to pull from… I used Perl.

I’m sure others could tell stories just like this substituting Java, or Python, or Erlang, or whatever they have around, that they are the most familiar with… and that’s fine.

This is about using the appropriate tool for the job, and this case, with the job being performed by me, the tool was Perl.

I wasn’t creating some new framework, or building upon an existing application, or pushing some code to GitHub that I wanted others to collaborate on… it was a quick ‘n dirty task that needed to get done as fast as possible.

Much of the programming world (maybe it’s mostly in the web-programming world) gets hung up on the latest and greatest. There’s a chance that using Ruby someone could have completed this task in half the time… but that person would not have been me, as I’ve spent probably less than an hour using Ruby and I’m not familiar enough with it to bang out the needed code quickly. I’d like to have some time to dig into Ruby (or, whatever, pick a language) and get familiar enough with it to use it effectively, but I don’t know when that will happen.

I’m not even a programmer… I’m a hacker, and I think Perl is a hacker’s language. Make something work. Solve a problem. Do it quickly, and move on.

To some degree you could say I’m trapped in Perl, because it is so easy for me to get what I want done quickly, and yeah, there’s a module for almost everything… Where I mainly feel the pain is when I look for example code and narrow my search to Perl (or PHP) because I’m most familiar with them. I needed some code this week to do some serial port communication, and found only one good example written in Perl. I should probably task myself with re-writing the code in Ruby, or Python, or some other language I’m not as comfortable with as an exercise in forced learning.

And then there’s a part of me that just says “screw it, I’m gonna work with what I know, and get things done, and move on.”


buy the button:

Buy The Button