Archive for the ‘rambling’ Category

What Makes a Good Programmer

Monday, April 14th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

For the last several months, I have been a programming and database tutor here at RIT in the Information Technology department. I have seen many students come and go for help, with varying levels of skill and motivation when it comes to programming.

I hate to say it, but I usually find my self disappointed in some students. I have been trying to figure out why they struggle with programming so much, and I want to try to help them get past the roadblock they are having… I have determined that one of the biggest roadblocks that students run into is having a profound lack of attention to detail and no patience.

Many times I get asked a question that could really be answered if someone just took some time to look at the code in detail, or think through a concept fully. I believe that people are fully capable of logical thought, so just taking some time is all that is really needed.

Step 1: Determine the problem you are trying to solve.

Even at the low academic level, you are programming for a reason. Before being able to code anything of value, you need to be able to abstract the fundamental essence of what it is you are trying to accomplish. If you are writing a program that will calculate area of shapes, that is one paradigm, another is connecting to a database. You must tune your brain to the frequency of the problem, and attack it from there.

Step 2: Develop a plan

Over the past few years, I have determined, I am not one to spend lots of time on design. In fact, I find that most design methodologies are too much overhead or too optimistic. I do however believe that you must always have a plan for what you are doing. A complex UML diagram is not needed, but a simple “WTF Napkin-gram” should usually suffice. Sure, part of this post is about detail, but the detail is most important in the code, not in the plan (this is my opinion… methodologists will wholeheartedly disagree).

Step 3: Code, and follow the plan

Here is where things start to go awry, and this is where I want to focus on a few key problems that I run in to.

People tend to write code blindly. You need to think about what you are writing. Every line should have purpose, and should be directly trying to accomplish the goals in your plan. Every line of code that you write that deviates from that plan is code that is considered ‘junk’. Look at the documentation for your language, and make sure you are not reinventing the wheel, but more importantly, understand what each function call you make does. Does it return a specialized object that behaves in a certain way? What are the bounds of your parameters? Take the time you need to make sure you understand each piece of what you write.

Focus on the error messages. A lot of the problems that I get asked to help with are (relatively) simple compile/syntax errors. Every language has some way that it can get these error messages to you, use them! This is where your attention to detail really comes in handy. You can look at a block of code and see things you might have missed, incomplete statements, and most common (but not always an error) incorrectly named variables. Make sure you understand the code you are touching, and be very explicit in fixing problems with it. Don’t shotgun debug, be precise about what you are trying to do,

Copying code is a bad idea… usually. This is one I am guilty of, in fact, most programmers are. There are several major flaws you need to worry about when you notice yourself copying code. The first problem is the most obvious, if you can copy code, there is a chance that the branch of code you are copying should be in a reusable function. Look at the code, see if you can abstract it to be a function call, and if so, do it! The second major problem with copying code is that its extremely easy to miss any changes you need to make to the code. For example, if you copy a few lines that are modifying variable xmlDoc, and you want the copied code to modify xslDoc, you might miss a change in going from xmlDoc to xslDoc. Happens all the time… so be careful. The third major point I want to touch on with copying code is this: I don’t recommend copying more then 3-5 lines of code at a time from another project. Be sure that you actually need the code you are copying. If you just grab an entire class file, you will likely need to change it enough that it might be a safer bet to just rewrite it… of course on that note…

Don’t reinvent the wheel. If code exists that does what you need, use it. In academia it is a little different, since we are trying to build up core concepts, but, in reality, if it has been done, you likely do not need to do it again. Many people could go on for hours about how important it is that programmers be lazy. I agree, programmers need to be lazy so they can see the way they can save time while coding, but remember that programmers also need to be proactive. You need to be able to spend time looking at documentation, and just playing with existing code to see what is already out there. Save yourself a headache later by taking some time to discover things now.

Program for programming’s sake. I guess this will be my last big point. A lot of people only code because they have to. Sure, this stuff isn’t for everyone, but if you want to be a good programmer, you need to do it a lot. Practice is how you begin to learn all the documentation, and all the tricks about a certain language (To Students: Yes, that is why I know where everything is in the javadocs). Really, the best thing I can recommend is to come up with a pet project, and do it. If it suits, trash the code and write it from scratch after you work out the initial kinks and know the problems you will run in to. The more you code, the better you will become.

These are only a FEW tips for becoming a good programmer. They are just some of the big issues that I see on a day to day basis with students here.

April Fools’ Day

Tuesday, April 1st, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

Laughter Everywhere.

Some people may be satisfied with the yearly Google prank, but not us. The idea to pull off some kind of April Fools joke was discussed as far back as December. Of course, we didn’t plan much, but I think it has turned out great… so… here is how it all went down:

Coming up with names for as many professors as possible was really hard. We should have thought about it more then we did, but with three of us, we came up with about 90% of the target names. Professors we had no experience with were generally left out because we didn’t know much about them, or what they would find ‘funny’. Names ranged all over the place, from simple nicknames and titles like “Resident Hippie | Weez” to “Minivan Driver | Humpty Dumpty”. Overall, the names took about 3 hours to come up with, but I think it was worth it.

The next step was putting the signs up. Mike, Zack and I walked around the floor and started putting the signs up. We only ended up having to reprint 2 signs due to typos… that we noticed. Putting the signs up was actually a lot of fun because we started to really see the scope of what we were doing.

We finished about 1:30am, and headed home. Overall the entire process for the night took a little over 4 hours. Not to bad considering. The only downside was that we don’t usually come in until much later in the day, so for now the plan was for me to wake up early and come see the reactions…

I walked in to building 70 at about 9:15am. I headed up the stairs and started walking towards the grad lab- I mean the “I CAN HAZ TUTORING” room. I got about halfway down the hall, then I heard a voice saying “Yeah, they’ve all changed”. Immediately a smile came. It was going to be a success, I could just tell from the sound in the voice. I started walking around, and I would run in to the occasional professor walking around the halls looking at all the signs. All smiling. Giggles here and there.

Some of the professors immediately could tell I was partially behind it, I mean, why else would I be in 70 before noon… carrying a camera and snickering? I walked back to my lab, waiting patiently for Deb to see her new sign. A few seconds later, I hear her laugh from around the corner. Got her! I walk down the hall to see her facial reaction. She knew it was me right away. I look down the hall and I start to see something I didn’t expect… people taking pictures. First I saw Dr. Kang taking a picture of his sign, then I saw a student walking down taking pictures as well.

What a great success!

Even as I write this blog entry, I can hear laughter as people walk by. Every now and then a good chuckle. The best part, is laughter lifts the spirits. I am happy to be here today, and everyone that is doing their walk around the building is smiling and giggling. I wonder how long everyone will keep their signs up? :).

Thanks to Zack Panitzke and Mike Galey for helping make this prank possible. You guys rock.

P.S. To any professors that might read this, Mike is up for a GA position next year — you should support him!

Another one of THOSE nights

Monday, March 10th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

Yep. Another one.

It starts, you toss and turn in bed… and then, the synapses start firing, you have an idea. Sure, it’s a good idea, but not even anything new. You’ve thought it before… but now your brain is thinking about it, more and more.

You turn over, trying to get the rest you know you need… but your brain doesn’t want rest anymore, it wants to keep going. Quickly, you try to tell yourself “It’s too late” or “I have to be up early”, but your brain doesn’t care… it is about to make you the most motivated person on the planet.

You fight the urge to get out of bed, but you are going to lose. You appease yourself by writing down the idea that you are obsessing on, perhaps if you take down the notes, your brain will let you sleep.

No. It doesn’t.

You find yourself tossing and turning once again, what seems like moments later. This time, it’s a different idea. It’s not even an idea anymore, its possibilities. What-ifs on paths that you never walked. Clearly, these are the things that dreams are made of, but they are too strong to happen in dreamland, they must be considered in your conscious state. You let your mind wander. Perhaps if you let your thoughts play out in your mind it will let you doze off. What seems like hours, but at the same time, moments, pass on… the thoughts progress away.

Letting the ideas play out, you start to get drowsy, maybe the sleep is on the way… but then, a new idea comes in. Your brain starts rushing with concepts, designs, excitement. The urge to create, the drive to proceed. You are afraid to even look at the clock, already knowing you are going to get less sleep then you need.

You try every trick you know to put your body to sleep, but your brain is simply to active. Despite not wanting to know, you look at the clock to decide if its past the point of no return. The moment somewhere between 3 and 6 am where it isn’t worth it to goto bed anymore.

It’s coming up on that moment… but the mind just will not let you sleep. The urge to be creative, the drive to design something is too great. Victory is not yours to be had tonight, the brain will win. You sit up and cultivate the idea. You draw, you write, and you ponder more, and more.

It’s another one of those nights. In reality, these are the nights that spark imagination, invention, and innovation… rare occurrences that should be praised and embraced. Of course, they cannot be, because you must consider the repercussions of disturbing the pattern of the next day by losing sleep.

And then, it stops.

Your brain gives in, and stops working in overdrive. Now you must decide, it is time to sleep, or is it time to work.

Sleep

Sunday, March 9th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

Sleep.

It’s something that I have done a lot of over the past week.

I find breaks very amusing. I don’t really travel too much, so I look at a break as an excellent time to get work done. I know, I know, I am weird.

So this break I had a list of things to do…

  1. Get healthy
  2. Work on independent study
  3. Finish up capstone proposal
  4. Rest

Well, the first one is sorta completed. I still have a little bit of a cough, but I am no longer sick. A warning to all: Do not get the flu on finals week. It sucks.

I was able to complete a little bit of work on the independent study that I have been working on… of course, I only got the work done today, and there is still a lot to do.

Yeah. Capstone proposal didn’t even get looked at.

Rest… now… I got lots of rest. I slept at least 12 hours a day, every day. Holy crap. I don’t know if I can go back to a normal sleep pattern now. However, the down side to doing this is that I really got very little done…. but I got rest… and that was the goal, right?
I wish I could have blogged more. Perhaps I will soon. I have a few comic ideas too. Here’s to week 1!

Finals Week

Tuesday, February 26th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

I have the flu. I don’t have time to sleep. I have major projects to finish.

This sucks.

I hope to post again when I am through this hell.

Chinese Fortune

Thursday, January 24th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

I ordered Chinese food today for when I was working in the labs. I finished it off then broke open the fortune cookie.

Be direct, usually one can accomplish more that way.

Now, lately I have been getting some pretty lame fortunes, but for some reason this one didn’t seem too bad. Sure, you can usually get better advice from a good friend then from a cookie (although, that can be iffy!), but sometimes hearing a ‘wise’ saying kinda gets your mind ticking.

Beating around the bush never helped anything. Of course, sometimes it is tactful to be subtle, but usually being direct is an appreciated change to todays really passive, polite culture. I personally can’t think of time where it is truly better to be indirect with someone… short term yes, but nothing really in the long term. Anyone have any ideas?

….and I just got an idea for a comic.. hmmm. Stay tuned!

The DreamHost Fubar, and Why I am Not Mad.

Wednesday, January 16th, 2008

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

DreamHost fucked up. Big time.

However, I am not nearly as mad as (seemingly) every other customer. Sure, I got the several hundred dollar charge, and yes, I was confused.

What happend:

DreamHost had an automated system that billed customers. A detailed account can be found on the DreamHost blog, but essentially what happened was they had an issue with their billing system. It was not charging customers on recently upgraded servers. While investigating they found the problem to be a 64-bit incompatibility issue and corrected it. They then went back to start billing the accounts. Starting from now backwards. For example, 1-16-2008, 1-15-2008, … 12-31-2008… and there was the problem. The biller, although robust, had the feature/flaw of billing up to future dates. All their customers were then billed for the entire year.

Yeah. Big fuck up.

Why am I not mad?

Well, in my experience as a developer, I have realized that “Shit Happens”. I still remember the feeling of when I accidentally sent out a non-approved blatantly “test” version of an e-mail to all of a Xerox mailing list. Wow. I thought for sure I would be fired. Was I? No. Now, was that a $7.5 million dollar screw up? No. Definitely not.

DreamHost has guaranteed to refund the money (I still can’t see that I have even been charged yet, maybe in a few days), and also requested that anyone who has incurred additional fees contact them, implying they will also refund those. For me, everything is fine. I have a high enough limit on my credit card, and plenty of money in reserve that this does not affect me nearly as much as some.

Others however, are furious. They have sworn to leave DreamHost, and are furious at the ‘mildly comical’ blog entry that DreamHost posted explaining what happened.

For anyone that has been a member of DreamHost for any period of time, you learn quickly that they are light hearted and silly in ALL of their customer correspondence. This is one of the reasons why I like them so much. I know that there is actually human beings that are working there, and chances are I wouldn’t mind having a beer or two with them (Although, I suspect after the other day they are likely going to be ingesting lots of beers). Why was this serious topic presented with a light hearted humor injected? Because that is how they communicate with their customers. It’s that simple.

They strive to be transparent when something goes wrong. I much prefer to read about what happened, and what they have done to fix it over a generic “There has been a billing error, it will be corrected shortly and you will be refunded” that I would expect from other hosts (and companies) that we usually encounter in today’s hush hush business world. Other companies would not tell us what went wrong, and surely would not tell us why it went wrong. They would merely state that a problem occurred and it will be corrected.

I hate companies like that.

So I ask these questions:

Did DreamHost screw up? Yes.
Did DreamHost fess up to the screw up? Yes
Did DreamHost explain what happened to cause the problem? Yes.
Is DreamHost correcting their mistake? Yes.
Is DreamHost going to do their best to make everything right? I believe so.
Is DreamHost going to lose a lot of money in lost customers and bank fees? Oh dear god, Yes.

I feel bad for the situation that DreamHost is in right now. You can not mess with someone’s money and come out unscathed. I can’t imagine the feeling that Josh (the person who hit the button) has. I am not mad at DreamHost for this. I know screw ups like this happen all the time - they just hit the jackpot of when and what to screw up. I am not leaving DreamHost anytime soon… although I do recommend they start putting more sanity checks on their internal software.

Lots more sanity checks.

2:58am

Monday, December 17th, 2007

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

What an hour to still be awake. Here comes the stream of consciousness

I kind of have to look at this past week and describe it as one stupid event after another. I put my foot in my mouth several times, I upset my best friend, Had other friends stop talking to me all together, and of course, I got even more behind on all my classwork.

However, I also used this week to try to really continue with my ‘reinvention‘. I was notably more outgoing at no voice zone. I also forced myself to just talk to people. Sure, all of the things I did may have caused some of the undesirable consequences mentioned before, but… it was worth it?

I find I haven’t been able to sleep lately. I need to listen to music to lull me to sleep - and it has never been that way before. Not totally sure if this will get better when break hits at the end of the week.

Speaking of. Is it Friday yet?

I have been programming in JAVA again as of late. My XML class project seems interesting, and in my excitement I have been putting that assignment on the top of my queue…. much to the dismay of my other courses (if they cared?). I wrote a pretty nifty drag tool. Maybe if I get some time when its not so late to post the logic behind it.. I will.

I think I may withdraw from my Beers of the World class right before the last day to withdraw… only so I can spend more time on other homework than it… because seriously, even an hour of working on homework for a class that is of no credit value to me as a grad student is silly when I have hours of other work to do.

I’ve been listening to music I haven’t listened to in a while, including Lucky Boys Confusion, Bon Jovi and Shades Apart.

I think I need to leave Rochester. I already know I am going to Boston over the break to work on TAP, but I really don’t know if that will quench my thirst. It might be time to throw a dart at a map and just do it.

I need to meet someone new that intrigues me.

I also need to sleep. So, here goes attempt 2.

Uncertainty

Friday, November 30th, 2007

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

My latest little doodle. Not really funny, but, from the heart.

Not Knowing

Was fun drawing, although scaling it down for the site kinda makes it look worse. Yes, my hand writing sucks… real bad.

Escape

Thursday, November 29th, 2007

del.icio.us Reddit Slashdot Digg Facebook StumbleUpon

This is a strange thing, that really only within the last year or so has started to happen. Whenever I get down, I always want to leave this city. Maybe this is normal for some people, but to me, it hadn’t been. Rochester is where I grew up. When I reflect on why I am still here… I can think of a few reasons. I only applied to RIT, I didn’t really care for any other college. At the time I was dating Megan, and I didn’t want to go far away from her (for several reasons, not all of them for the right reasons). So, I stuck around.

Years after, I never had to really pursue a co-op, so I never had to leave town. After I graduated, I got a job at StormFrog, so I stuck around some more. Now I am back for grad school, at RIT. So, here I am, down, and wanting to escape. To leave this town, if only for a little while. I’ve tried it before though, and it really doesn’t help. I get back and I want to leave again, and again.

But I can never bring myself to leave.

Today I was extremely close to packing up some clothes, and just hitting the road. Heading a direction and not caring where I ended up. I didn’t do it. I rarely seem to do it when I would have to go alone. I would have done it this time if I could have found someone to go with me… but nobody had enough free time to do it. So I am here, thinking about what if I did leave, and still wishing I did.