logo

My Coming of Age (as a Developer)

The other week I posted on Google+ about the warm fuzzy feeling I'd gotten when writing this line of code:

public class Poster extends Entry implements IEntry

Why so? Because all the classes involved were of my own making. Finally things had started to come clear to me; I understood the importance of class inheritance and the role of implementable classes.

While I'd kind of understood this for a while it wasn't until it all clicked and I actually did it for myself that I could truly say it really made complete sense.

The Poster class the code refers to lives inside a Flex-based app I've been working on for a while now that lets school kids create artwork from photos they've taken by adding their own words to them. The app is the closest I've come to making actual software. 

As well as posters they can create a Calendar, which is also an Entry-based class. Posters and Calendars both consist of one or many pages. For this there's a Page class, which has a property that defines what size of paper it's based on. Ultimately the kids will print out their entries, so the paper size is important, so as to get the proportion of width/height right.

In order to define the paper sizes available I created another class called PaperSize, which you can see below (the code is ActionScript 3, but is a lot like Java/most other languages).

package 
{
    public final class PaperSize{
        
        public static const A4:PaperSize = new PaperSize(595, 842, "A4", "A4 (International)");
        public static const Letter:PaperSize = new PaperSize(651, 842, "Letter", "Letter (US)");
        
        public var width:int;
        public var height:int;
        public var name:String;
        public var description:String;
        
        public function PaperSize(width:int, height:int, name:String, description:String){
            this.width = width;
            this.height = height;
            this.name = name;
            this.description = description;
        }
        
        public static function AllSizes():ArrayCollection{
            return new ArrayCollection([
                PaperSize.Letter,
                PaperSize.A4
            ]);
        }
        
        public static function get Default():PaperSize{
            return PaperSize.Letter;
        }
        
        public static function findByName(name:String):PaperSize{
            for each(var size:PaperSize in AllSizes()){
                if (size.name.toLowerCase()==name.toLowerCase()){
                    return size;
                }
            }
            return Default;
        }
    }
}

Again, the fact that I wrote the above code un-aided and without any kind of copy-pasting off the internets was nothing short of a revelation for me. Once again I got that nice feeling, knowing that I'd written the class all on my ownsome.

I'm not saying the above PaperSize class is perfect, but it works well for me and does everything I need it to and in a way classes were meant to (at least as I understand it).

I'm sure you guys can offer suggestions to improve it (and I welcome them) but my point here is that I finally understand how and when to use static classes. Finally, it's all coming together.

It's not only writing the classes that give me a nice feeling. I get the feeling over and over again each time I refer to my classes and type-ahead popups, suggesting properties that I made appear there, as below:

image

With the class I can do things like:

page.height = PaperSize.A4.height;

or

paperSizePicker.dataProvider = PaperSize.AllSizes();
paperSizePicker.labelField = "description";

or

entry.paperSize = PaperSize.findByName(xml.@size);

The findByName() method comes in handy as each Entry gets stored as XML, so the students can come back and re-load/edit them at a later date. The XML holds the name of the paper size used and I can reload it when needed.

My point? Not sure really. As ever, just sharing my adventures in coding. Also wanted to share my excitement that - after 15 years as a "developer" - I can finally call myself a programmer without feeling too much like a fraudster.

What about you guys? Am I the only saddo who gets a kick out of seeing their own classes' properties and methods appear in code type-aheads when programming?

Comments

    • avatar
    • ChrisC
    • Wed 5 Oct 2011 05:31 AM

    Jake,

    Good stuff!!

    This to me is what XPages is all about. Its not really the UI or the presentation or whatever. Its the combination of drag and drop development with the power of a proper development environment. Java classes, Eclipse, OSGI plugins and all that....Proper code structures, enterprise development, code re-use etc etc. The hooks into the gazillions of other Java based api's are also an important follow up point.

    Add to the NSF and the ability to hook into web services, open auth, RDBMS in a drag and drop kinda way is a subject for a different day...

    • avatar
    • CJ
    • Wed 5 Oct 2011 06:40 AM

    Having been a notes developer for many years, and having moved into C#/ .net development about a year ago I'm also getting the same kind of kicks you're talking about.

    I know what you mean about understanding what things mean, but until you've had to do them yourself it's not quite the same. As Morpheus says in the Matrix "There's a difference between knowing the path, and walking the path"!

    There are certainly some frustrations with it, but generally I end up putting these down to my lack of experience and in the end it's nice to think like I'm developing "properly" with a proper OO language.

      • avatar
      • Jake Howlett
      • Wed 5 Oct 2011 06:55 AM

      Phew. I'm not the only saddo then ;-)

  1. Situations like the one you are describing are the highlights in a developers life.

    I also really enjoy the moments where I suddenly have a true, clear sight on things (for sure without drugs involved ;-) . Especially when you do things in a similar way since ages and suddenly it clicks inside your brains WHY you are doing it this way.

      • avatar
      • Jake Howlett
      • Wed 5 Oct 2011 06:57 AM

      Glad you agree. I'm trying to cherish the opportunity this project is giving me as I get the feeling these highlights are few and far between. For me at least, most work is fairly mundane stuff. It's not very often I get the chance to start a new app from scratch and define the whole class structure on my own.

      Most of what I seem to be doing lately is maintaining and bug fixing other developer's Domino apps. Ouch.

      Show the rest of this thread

    • avatar
    • Nick
    • Wed 5 Oct 2011 07:00 AM

    Also a domino developer to C#/VB.NET developer...definate 'A-HA' moments....and makes everything easier to understand and read. Enjoying myself as well.

  2. It's another level of abstract thinking to get to where you're extending AND implementing. :-) I tutored a CS student in java last year (and it has been a while since I was doing full time hard core java) and was myself tutored in the process. Not only is there much to learn, there's much to forget. And on top of that, modern CS studies are getting deep into patterns that go well beyond our basic understanding of classes and interfaces. Both comforting, in that we know there are more adventures ahead, and humbling.

  3. "code type-aheads"? vi doesn't do code -type-aheads

    • avatar
    • Ferdy
    • Wed 5 Oct 2011 01:10 PM

    Goob job Jake, and do cherish the moment where you are having such insights and are proud of your own work. It's a rarity for many.

    On another note, the thing with OO is that it is often explained in an easy way. Take any text book and it will explain to you that object "Horse" is inherited from "Animal". Perhaps you inherit the property "legs" as an integer and "breathe" as a method. People understand this stuff, since they understand the actual classes/objects and their relationships from the physical world.

    Then you get to see some real world code and suddenly the objects are abstract. You get things like "FactoryEntityImplementerInterface". You can't imagine or visualize what it is, what it is supposed to do, and what relationship it would have with any other abstract object. It becomes a lot harder then.

    And as objects get more abstract, the amount of ways you can design them increases. It will not be neutral, it will be designed according to how that specific developer thinks. Finally, there is armies of developers really doing procedural development wrapped in OO static classes.

    It's hard to determine the right way and it's hard to get it right. Don't think the world is full of OO wizards and you are late to the party. Almost everyone struggles with it.

      • avatar
      • Jake Howlett
      • Wed 5 Oct 2011 02:29 PM

      "Don't think the world is full of OO wizards and you are late to the party."

      Funnily enough, that's pretty much how I was feeling. Glad it's not the case.

    • avatar
    • Giulio
    • Wed 5 Oct 2011 05:53 PM

    Object orientation designs can be analysed.. objectively, (pun intented ha!) and with synthesis. But I also find it a black art at times. The SE libraries are well written, I find all the extensions written by academic developers the pain in the ar$e with their over abstracted interfaces.

    Good code is like Steve Krugg. Don't make me think!

      • avatar
      • Giulio
      • Wed 5 Oct 2011 05:54 PM

      I mean Steve Krugg's bool.. (Damn keyboard)

      Hide the rest of this thread

        • avatar
        • Giulio
        • Wed 5 Oct 2011 05:54 PM

        Book* Aaargh!

      1. 2nded. On many points. Overly abstract implementations drive me mad and have given Java a justified poor characterization as being an academic language, my self having said the same many times.

        Albert Einstein said, "Things should be as simple as possible, and no simpler." So many CS students look right past this obvious optimization.

          • avatar
          • stephen neal
          • Fri 7 Oct 2011 04:40 PM

          OO, it's a love hate relationship for me!

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Wed 5 Oct 2011

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content