"Web Guys"vs "Real Programmers"

Michael J. Braude wrote a post on why he’ll never be a “web guy”. The gist being, the annoyances of writing for the web are not the sort of challenges he wants to tackle as a programmer.

Then Jeff Atwood gave his two cents on why programming for the web is where it’s at — it’s fast, it gets seen by more people, and more and more great apps are being made on the web.

I’m sure Michael has a point. I think the way he said it got up Jeff’s nose a little (it certainly got up mine), but it’s valid. For some, the web just seems simple and trite. My lecturer thinks like this I suspect. I also agree with Jeff that it’s somewhat myopic — if you dismiss web apps, you dismiss a lot of clever, well written programs right out of the gate.

The debate got me thinking about why I’m studying programming. I’m a web guy, but not even “smart enough” to “throw an ASP.NET webpage together”. But I see the innovation in web pages. I also see how useful these technologies will be moving forward. While Michael is coding apps that will work on one type of system sitting on someone’s desk, programmers like Jeff are making universally accessible programs that are instantly available to anyone with access to the internet. I could learn to regurgitate borrowed code in half-arsed web pages and validate Michael’s argument, but I’d rather learn to do it properly.

When I was leaving high school and thinking about what to study, the web was just starting to become mainstream. One teacher I got advice from had been programming years earlier and painted a picture of a world of drudgery, typing pre-written code without chance for innovation or personal expression. It was not a nice picture. I probably let myself be swayed by it too much I’m sad to say now.

What I discovered in the years after, is how exciting the world of web programming can be. Instead of being a small cog in a giant programming machine, a web programmer can be a vital part of a small team who’s work can be seen instantly. Of course I know now the same can be said of non-web programming, but the web was what opened my eyes.

So I’m going back to study to do something I should have done all along. And I’m going so I can understand: “virtual methods, pointers, references, garbage collection, finalizers, pass-by-reference vs. pass-by-value, virtual C++ destructors, or the differences between C# structs and classes”. And then I’m going to use that knowledge to make the best web programs I can make. Maybe along the way I’ll learn enough that web programming seems trite to me too, but I’m not expecting to. I agree with Jeff, and strongly believe good web apps are only going to become more important.

I want a slice of that action.

Javahackercoding 3: With a Vengeance

This week has been mad. Both my girls have had colds and one has been teething1 , so finding time to study between looking after them (and myself to make sure I don’t get it too) has been difficult. I’ve read my chapters, but I’m not one ahead like I wanted to be. And I’ve only done two of the five exercises for this chapter. It’s my first real OO introduction too. Until now I’ve understood “int”, “double” etc. but now we’re getting in to what has been behind the veil for me when I’ve tried to program before - how you create classes, and call them from other classes.

So I’ve built my Rectangle class and it looks like this:

public class Rectangle {
    private double length;
    private double width;
    private double area;
    private double perimeter;

    public Rectangle(){
        this.length = 1.0;
        this.width = 1.0;
    }

    public Rectangle(double theLength, double theWidth){
        length = theLength;
        width = theWidth;
    }

    public double getArea() {
        area = width * length;
        return area;
    }

    public double getPerimeter(){
        perimeter = (width * 2) + (length * 2);
        return perimeter;
    }
}

Now feel free at this point to tell me where if I’ve gone wrong there. At line 12-14 the book tells me to do this.length = length; and so on, but I wanted to try it the other way here just to wrap my head around what was happening. So that’s all well and good and we go on to make a test class, RectangleTest:

public class RectangleTest {

    public static void main(String[] args) {
        Rectangle small = new Rectangle(2.0,3.0);
        Rectangle noArgs = new Rectangle();
        Rectangle large = new Rectangle(20.4,30.6);
        Rectangle notDouble = new Rectangle(4,6);
        Rectangle stupid = new Rectangle(3.2,400.1);

        System.out.println("Small rectangle: A=" + small.getArea() + "
        P="+small.getPerimeter());
        System.out.println("Default rectangle: A=" + noArgs.getArea() + "
        P="+noArgs.getPerimeter());
        System.out.println("Large rectangle: A=" + large.getArea() + "
        P="+large.getPerimeter());
        System.out.println("Rectangle not written as double: A=" +
        notDouble.getArea() + " P="+notDouble.getPerimeter());
        System.out.println("Stupidly proportioned rectangle: A=" +
        stupid.getArea() + " P="+stupid.getPerimeter());
    }
}

Now that seems fine to me too. Maybe you can point out something I’ve missed, because when I run the thing (which works exactly as I’d planned btw) I get this output from NetBeans:

Small rectangle: A=6.0 P=10.0
Default rectangle: A=1.0 P=4.0
Large rectangle: A=624.24 P=102.0
Rectangle not written as double: A=24.0 P=20.0
Stupidly proportioned rectangle: A=1280.3200000000002 P=806.6
BUILD SUCCESSFUL (total time: 0 seconds)

Can you spot the weirdness? Why would the Area be returned as “1280.3200000000002”? I added a method to just display the area alone2, and it’s definitely being calculated as 1280.3200000000002, which is just strange, and I want to know if it’s something I’ve done incorrectly, or a quirk of Java/NetBeans.

So that’s where I am. I’m gonna’ read up on the next chapter before class tonight. And if I get time, I’ll do some more of the exercises too. So if I’m not on the right track, please tell me before I go to far!


  1. I’ll let you guess which ↩

  2. public void displayArea() {System.out.println(getArea());} ↩