Pages

Tuesday, July 31, 2007

Zombie processes and Forward momentum

I’ll get the easy one out of the way first: Zombie processes. This morning, it felt like someone flicked the switch because I feel like a zombie. 15th day programming without much of a weekend and I think it is starting to take its toll.
It does sort of lead onto the second thing though: Forward momentum.
A while ago, I started build one of my lego models:

And because that was rather relaxing, I built my spaceship:
So, from the looks of things, you would thing I was powering forward. My biggest drawback is that I still haven’t setup my server. It is sitting there, ready to go. Just got to get it up and running.
I was looking at writing a java port forwarding program just for the joy of writing something that requires a lot of thinking power. Given my current progress, I think I should just bite the bullet and use standard configuration items.

-= Comments
1. Xavier Shay | July 31st, 2007 at 2:06 pm
LOOKOUT YOU CAN’T PRINT ON VIDEO GAME CONTROLLERS

2. Jonathan | July 31st, 2007 at 9:31 pm
*

1. Xavier Shay | July 31st, 2007 at 2:06 pm

LOOKOUT YOU CANĂ¢'T PRINT ON VIDEO GAME CONTROLLERS

Ok, I laughed. God how I miss lego.

3. pimaster | July 31st, 2007 at 9:36 pm
Ah, so that is what I have been doing wrong.
oh, I forgot I clipped out the picture of the cups test page.

Wednesday, July 18, 2007

A physical weekend

So another weekend passes by. I didn’t do any coding this weekend as I was assisting my dad with installing some poles for a shade sale that we are putting up in the front lawn to give some protection to the cars.
It has been a while since I did some heavy lifting and manual labour, but it feels good. You can stand back and enjoy what you have built.

But there has been one thing bothering me this weekend. Friday afternoon, one of my colleagues put in an email a discussion of how we are currently tackling software problems.
In one short sentence, stated that MVC and OO design principals do not work together. I thought for a second: “I’m writing objects, I’m keeping logic separate. I am making them work together, what is she on about”. Moments later and a little more reading (and thinking back to Uni days): “MVC keeps business logic away from the business objects. OO is meant to have methods that modify the model close to the model. We are all taught that a Bird object should be able to fly (OO). You don’t pass a Bird thing to a Bird controller telling it to ‘make it fly’ (MVC)”.

Quite honestly, I’m a little lost. You can’t change your whole approach mid-project (especially when you are half way through and have 2 weeks to go), but what am I going to do after it?

Where do I begin?
It almost feels like everything I have learnt has just flushed out the ears…
Somewhere I am hearing “What works for one project may not work for the next” :D

-= Comments
1. Matthew Delves | June 18th, 2007 at 7:52 am
From my limited understanding of MVC, you would have a bird that knows how to fly, it is then the controller that tells the bird where to fly to.

Hope this helps.

2. Xavier Shay | June 18th, 2007 at 2:22 pm
Controllers are responsible for the “flow” of the application. In web based apps, 90% of controllers either just render something, or save a model then redirect based on the result (success/failure). Controllers are glue, and you want as little of it as possible.

(In the rails world, this concept is often referred to as skinny controller/fat model)

3. Xavier Shay | June 18th, 2007 at 2:24 pm
… and remember, you generally want one model per view/controller action, so if you need a composite form or something, look into the Presenter pattern.

4. Zooba | June 18th, 2007 at 7:25 pm
I agree with Matthew, that’s how I understand it as well. At least in OO terms.

If you apply MVC to a RDBMS your business logic is kept in the controller with the data/information kept in the entities/tables.

The issue here seems to be the divide between what is the controller’s responsibility and what is the object’s responsibility. IMHO, the entity should have entity logic while it is the controller that has business logic. To carry on with the previous example, a Bird knows how to fly, but the controller knows (and tells the Bird) when and where to fly.

5. Xavier Shay | June 19th, 2007 at 2:00 pm
No way … what is the point of having a Model layer if your model is just … data? A PurchaseOrder should encapsulate the “business logic ” of what happens when it gets paid for.

I don’t like the bird example … you don’t model a bird in software and it doesn’t map to real systems.

Friday, July 13, 2007

Email comments. Commenting in emails

I need to write this post so that I can remember to use it in the future.
Email addresses are allowed to have comments in them.
<username>+<comment>@<host>
[Edited 19-07-07 as I forgot to escape the >’s]
You can even include multiple +’s (or (\+.+)+ for those among us that love regex)

Just incase you can’t form the right query in a search engine, here is the very useful blog entry I came across:
Anders Jacobsen’s blog

-= Comments
1. Xavier Shay | July 13th, 2007 at 2:56 pm
Rule #1: Don’t ever use a regex to match an email unless the author provides RFC compliant tests. There are so many shit email regexes on the internet AND IT ANGERS ME