Bill Roper (billroper) wrote,
Bill Roper
billroper

Refactoring

This was entertaining. I have ported a couple of thousand lines of my experimental code from C++ to Java. In the process, I've rearranged it so that many of the interesting objects are now members of enumerated types in Java, each of which knows how to write the encoded XML that the consumer of the objects wants.

Better yet, I've added a style class that allows me to stack those interesting objects together to control how our data will be displayed in the grid. And the style class knows how to write the encoded XML that the consumer of the objects wants as well.

What this means is that all of the little magic numbers that were embedded in our code have been sent off to live in my new enumerated types and the style class, so that when we want to apply a style to a cell, we can just apply it by name instead of having to remember the number for the particular style that we want to use here. Better yet, I can create a style, clone it, and then add a bold attribute to it and stick it into our style sheet.

This should make life *much* simpler.

Next week, I'll generate all of the necessary styles and plug this in and see how it works.
Tags: java, musings, work
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments