Sunday, July 22, 2007

Seven Days

That how many days I've worked in my new job. I getting a little tired of typing "new job", and I probably wouldn't have even looked at this one if Gary hadn't pushed me forward for it, and I got it simply by having a chat with someone who's not even my boss.
It's gone quite well, although I do feel a bit overwhelmed by it. I think Gary's been running the office, and so it may not have been the best idea to start when he was away.
Since he's been back in the office, I've kind of discovered I've been left to pick up one project whilst he goes off and rescues the other one. This is fine, but with a few exceptions.

Firstly, it would have been nice to be given time to get to grips with what the project is, what the technical constraints on it are, and some idea of deadlines before the day before a customer visit (and two days before an apparent payment deadline, which may in fact not be for another four days).

Secondly, the codebase was, and still is, in a mess.
The Data Access Layer is a mish-mash of some code generated stuff (which I have nothing against, just if you're going to code-gen stuff, make the code-gen part of the build), which is quite comprehensive but very difficult to change, some copy-and-pasted components, which to me seem buggy and, in some cases, wrong, and some hand-written stuff to try and hide the mess from the application.
The UI layer is a nasty mess - mostly prototype code which has been altered to use the Data Access. Lots of messing around with values in a datagrid, rather than using the business objects.
The "business layer" is the prototypical Anemic Domain Model.
Overall, there's quite a bit of duplicated code, long methods, and comments explain the what, not the why. Worst of all, this is all legacy code (no tests, and not factored for easy testing). I'm so glad I bought a license for Resharper.
In fact, as I think about it, I'm going to put together my library to take in tomorrow.
Goals for the rest of the week are:

  • Finish the removal of some of the heavy weight code-generated stuff I started on friday.
  • Refactor out some of the business logic from the UI.
  • Educate the team on how to write loosely coupled code. Simple things like CODE TO INTERFACE, LAW OF DEMETER and INVERSION OF CONTROL - perhaps even start a page-a-day club on Jeremy D. Miller's excellent Write Your Own CAB series. (I know I could do with getting the chance to catch up with about half of it all of it).

Saturday, June 30, 2007

Too Quick To Judge


Marbles, originally uploaded by b3ardman.

So, anyway, about the marbles...
Turns out that the parcel that they tried to deliver on my birthday was a tub (with a sack included) of marbles.
I've not been able to confirm that this was from the offender, but all the clues are there.
So, I retract my accusation, and my thanks go out to the purchaser of the marbles.

Friday, June 29, 2007

Beardy Box: Welcome To Beardy Box

I've started a separate blog for all my nerdy programming stuff. If you want to see it, it's over here: Beardy Box: Welcome To Beardy Box

Thursday, June 28, 2007

Marbles

Many years ago, a friend, and colleague at the time, promised me a sack of marbles if I did a job for him. The marbles never appeared, despite polite reminders.
I met this friend recently for a drink and chat, and, what with my birthday approaching, he said he had a great idea for a present. He also told me that, if I had a good enough memory, I'd be able to guess what it was. I didn't get it at first, but I soon realised he meant the marbles. He confirmed this, and said he'd seen some good ones.
Anyway, my birthday has been and gone and there are no marbles.
I'm not going to tell you the offender's name, but those who know about this will know who he is. Needless to say, if he offers you a sack of marbles in return for you doing something, don't believe you'll ever get those marbles.

Monday, June 25, 2007

Umbrellas

I don't usually an umbrella, because I think they are a complete waste of time. Instead, I'll don my waterproof jacket and over-trousers and face the weather with impunity.
However, because my over trousers have got a bit muddy (the sign of genuine use), I've been using an umbrella for my commute.
There are a number of reasons why this isn't going to happen any more:

  1. On the train, there's nowhere to store a wet umbrella.
    I usually end up having it crushed against me.
  2. Umbrellas only keep your head and shoulders dry.
    Whilst I don't get rain in my face, the rest of me get soaked.
  3. Umbrellas don't protect you from cars, one of which will inevitably drive through a massive puddle you're cautiously passing. Bastards.
  4. Umbrellas have a distinct design flaw in that they don't turn inside out without breaking.
    Usually, and this is anecdotal observation, when there's rain enough to use an umbrella, there's also a strong breeze. All you need is to walk past the end of a building that has been protecting you from the wind, and your umbrella's fucked.
  5. Umbrellas are too easy to forget.
    It rains on the way into work, then it's sunny on the way home, so you forget about your brolly until the next morning when it's raining again, and you're cursing yourself because you left your brolly at work.
So, anyway, that's a brief overview of why I'll be binning the brolly and wearing my wet-weather gear again.

Monday, June 11, 2007

Taking Money

No owning a credit card, I'm often disappointed when web stores accept neither debit cards nor on-line payments (such as PayPal).
I think it's a bloody disgrace, especially as you only usually get to find this out when you've been through the tortures of registering on a site, and you're just about to pay.
Most recently, this experience was with Expedia.co.uk. They say the take Switch/Maestro, but not for all purchases. So, when it came to buying flights to Thailand (these cost > £1k for Amy + I), I was disappointed when I got through their procedures, entered passport numbers, set up meal preferences, only to find they didn't want my money.
Anyway, we ended up buying them from someone else.
The point being that if your site doesn't serve your (potential) customers, they will go somewhere else. I know I did.

Tuesday, June 05, 2007

Shuffling a List in C#

Inspired by this post:

static Random random = new System.Random();
public static IList<T> Shuffle<T> ( IList<T> deck )
{
  int N = deck.Count;
  
  for ( int i = 0; i < N; ++i )
  {
     int r = i + (int) ( random.Next( N - i ) );
     T t = deck[r];
     deck[r] = deck[i];
     deck[i] = t;
  }
}

Monday, June 04, 2007

Lazy Reporting

I was looking at this news story on the BBC's Website (my brother lives in North Tawton). However, the last few lines of the story are some of the laziest reporting I have seen lately (probably because I don't read a local paper):

Another neighbour, who would only give her name as Jo, said: "It is always a tragedy when kids are involved."

So, looking at this, there was some lady who wouldn't give her name who said something really generic, and frankly wrong.

Cambridge Dictionaries define tragedy as
  1. a very sad event or situation, especially one involving death or suffering, or a play or literature about death or suffering.
  2. a play about death or suffering with a sad end, or this type of play generally.
So, it's not always a tragedy when kids are involved, it's a tragedy when someone dies or suffers.
I pay a license fee for this rubbish.
 


Wednesday, May 30, 2007

What do your objects do?

I was thinking about how most of the system at work has objects that don't do anything (yes, this is the Anaemic Domain Model code smell).
Last week I broke up a control and refactored it into a Model-View-Presenter, as it allowed the right amount of code reuse for what I was trying to do. Also, I extracted some interfaces (including one for the presenter).
Today, I've been trying to explain this to a colleague. I think I missed the point about programming to interfaces rather than implementations, and also the colleague got rather confused about why he couldn't reuse the interface to do his different control. I think mentioning something about intent.
I need to remember that even when following established patterns I need think about what I'm coding.

When you work in a city

it's easy to forget that other people might be on your train for something other than work.

Tuesday, May 29, 2007

Seven Ages of Rock

On saturday, I saw the "Art Rock" episode of Seven Ages of Rock. Apart from the fact that some of it was progressive rock (which put me off entirely!), I wasn't that taken by it. Primarily, it seemed to praise Pink Floyd and David Bowie. Fair enough, I think Sid Barrett and the Bowster have some influence, but Bowie himself, on the program, admitted that he followed Barret very closely.
Then, at the end, after spending a sizeable chunk of the program on Floyd's Wall (the one they built during their shows), they bought on Genesis. Again, worthy of a mention, if only for Peter Gabrielle's  outstanding contribution to music, but really.
The other problem I have with the series is that it completely ignores Post-rock. Imagine a one-hour show charting stuff like Slint, Godspeed You Black Emperor, and Mogwai. Now that would be worth watching, rather than all the Dad-rock chart tunes that the shows have so far covered.

Bank Holiday

Well, that was a reasonably uneventful bank holiday weekend.
Highlights:

  • Failed Chocolate Truffles (that instead made delicious chocolate mousse like dessert)
  • Vegan Moussaka - perhaps not exactly a "light bite", but a filling meal, especially with home cooked bread.
  • This is England - disturbing and slightly lightweight film about skinheads in the 1980s.
  • Walk up to see Eastergate Bridge - the bridge itself was a bit disappointing, but the walk was really beautiful. Got really close to some swallows who didn't seem to mind us at all.

Friday, May 25, 2007

Some days...

Some days I can really focus and get lots done. Other days, like today, I find it really hard to focus, and I end up writing lots of blog posts and surfing lots.

Lunch

've got sushi for lunch. I made masses of it last night, so I've got 12 pieces. That should see me through 'til next week.

Wednesday, May 23, 2007

2 Screens

I've been given the use of an extra monitor at work - so now I have one 19" and one 17" monitor on my desk. I've been given a bigger desk too, but that's by the by.
I have to admit that, mostly, I still use the 19" for the majority of my work, and, as I'm doing web work at the moment, use the 17" as a preview screen.
Windows XP works flawlessly with more than one monitor, and there are a few utilities you can use to add a few niceties. Of these, I've been trying UltraMon out, and it rocks. As well as giving each monitor it's own task bar, it allows you to do things like have one background across both monitors (making a massive panorama), have separate screen savers, and a host of things I've not even tried. I wouldn't say it's essential, but it's definitely worth the tiny cost.
I really like having two monitors - it allows things like having two versions of code next to each other, VS2003 + VS2005 visible simultaneously, and generally a lot less swearing when trying to find the right window - with more of them visible, I can find the one I want more easily.
Despite this, I think that if I were to buy a second monitor at home I'd try and make sure it was exactly the same model as the one I've currently got (or buy two new ones of a different model). At the moment, the 17" at work is just showing colours differently to the 19" and, although with the different pixel size (they're both 1280x1024), it's not easy to switch back and forth quickly.
That aside, I'd definitely recommend - I really didn't think it would make as much difference as it does.

Wednesday, May 16, 2007

My Glasses Need Cleaning

I'm surprised I can see anything at all.

Monday, May 14, 2007

Oh rennet

From chris: http://www.vegsoc.org/news/2007/mars.html
Amy's very pissed off, as Minstrels are her comfort food.

Tuesday, May 08, 2007

Why Comments are Evil

 return false ;  // raise exception

Wednesday, May 02, 2007

Oh shit...

...I actually wrote the words "creative avenues" in an email I just sent.
I laughed at myself when I wrote it, but now I'm worried other people will think I meant it.
Oh shit.