Nov 21, 2008

Benefits of working from home - Part IX- Infrastructure

In this post I described how using my computer in my home office was the first time that I'm getting a direct return on my investment.

In this post I'll take a look in the other side of the coin: the investment in infrastructure.

When my home computer used to be only that, i.e, my home computer, I had no hard requirements to keep it up to date. I could simply update it each 5 years or more if I wanted to; also, my internet connection need not to be very fast; the same applies for my desk; it could be very ordinary as I didn't spent a lot of time in my computer.

Of course, being a computer/programmer addicted as I am, shortened my computer's update cycle for something between 2 ~ 3 years, and 


internet connection, you know: you never get enough bandwidth ;)

By the other hand, using my computer to work pushes it to its limits... and of course, each minute I spend looking at the hour glass represents a minute less with my family (or my Wii :) so I want to wait the lesser amount of time possible in front of it.

Just to put some numbers, the first time I run db4o build on my machine it took more or less 1 hour to run to completion (mostly running tests). I just couldn't believe that. My machine was not a top one but it was not so old/slow either. After a lot of tweaking I managed to get the build running in 15 minutes but that required some $$$ (nowadays, even with a new machine tests take 20 ~ 25 minutes to run due to lots of new tests).

Also, I never considered (or had the requirement to) run 2 VMs, 2 Visual Studio (one in one VM and another in the host OS), Eclipse and some other apps at the same time. So now, 2Gb of memory doesn't look that much anymore.

Another important aspect that will have great impact on your productivity/health is the
overall quality of your office furniture: remember when you used to complain about your boss not willing to spend a few extra dollars on a good chair for you? I certainly remember myself complaining with mine :( Of course you don't need to go out and get the best chair in the world, but make sure you'll not get a "not so good" one only to save a few extra bucks either (If you are going to spend more than 4 hours seated I do recommend you to get a very good one - for instance, this one).

Well, that's not the end yet; telecommuting meant also that I became my own IT department ;). Not that I have any problem fixing my computer, installing software or whatsoever; the really big point is that all these maintenance work takes time (and time is money) and also that the burden to keep everything working is on me (to be fair, I'd rather be the one in charge for this task than to let someone else doing it
anyway).

Last, but not least, consider having "hardware" backup; I mean, what are you going to do if next morning when you turn your computer on it don't actually turns on? Of course you do have backups of your important data (don't you?), but what about your hardware? How long it will take to be fixed? Are you willing to spend time on fixing it? Or do you have another computer that can be used so you can continue to work while someone else fixes it for you.

In the end of the day, you'll need to put some money on your office / infrastructure, so don't forget to take this into account.

That's it.

Bear with me ! We are approaching the end :)

See you

Adriano

Nov 17, 2008

Changes in Db4o configuration.....

Hi,

If you take a look in our svn repository you'll see that lots of changes were applied to configuration code (starting with version 7.7). Take it easy, we kept the "old" configuration interface in place; we just deprecated it, so update your code to use the new interfaces if you have the chance ;)

In this post I'd like to discuss some of these changes.

New, specific, factory classes


Do you remember Db4oFactory OpenFile(), OpenServer() and OpenClient() methods? We decided to move them to more specific factory classes:
  • Db4oClientServer
  • Db4oEmbedded
This way the boilerplate code used to open an embedded database changed from:

IObjectContainer db = Db4oFactory.OpenFile("MyData.odb");

to:

IObjectContainer db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), "MyData.odb");

As an additional benefit now we use the same class in both platforms (Java/.Net) (Remember, we used to have Db4o.openXXXX() for Java and  Db4oFactory.OpenXXX()for .Net).


Configuration interface split in File / Network / Common

We are applying Interface Segregation principle to configuration, so, now related configuration options are close together in specific interfaces.

For instance, all embedded related configuration lives in IEmbeddedConfiguration. But we didn't stopped there. We went a step further and broke common functionality in more coarse grained interfaces. For instance, there are configurations that do apply to both embedded and client server modes. So we introduced the concept of Configuration Providers which sole purpose is to help to aggregate configuration into specific interfaces, so it's easier (at least in our opinion :) to identify which configuration applies to each db4o mode and also make it more clear which aspect of db4o are being affected by that configuration.For instance:

IEmbeddedConfig config = Db4oEnbedded.NewConfiguration();
config.File.ReadOnly = true;

In this sample there's no space for doubts that ReadOnly configuration relates to a file system aspect of an embedded database.

That said, we basically partitioned configuration into four categories:
  • Embedded
  • Server
  • Client
  • Common

No more "default" configuration;

Suppose your application, at some point, requires a Db4o database with an activation depth configured to the highest possible value (in most scenarios this is not recommended) so you use some code like this:

IConfiguration globalConfig = Db4oFactory.Configure();
globalConfig.ActivationDepth(Int32.MaxValue);

using(IObjectContainer db = Db4oFactory.OpenFile("test.yap"))
{
/* Use the database */
}

So far, so good. Now, in a completely different point in your application you need to open another Db4o database and so you just type:

using(IObjectContainer anotherDb = Db4oFactory.OpenFile("test1.yap"))
{
/* Use the database */
}

This new database ends up configured to fully activate objects! Even knowing that you should avoid configuring activation depth this way (you did your homework, right?) it's possible to do it by accident.

The problem is that it is relatively easy to mess with configuration.

That's the reason that now, all OpenXXXX() methods (in the new factories) requires a configuration to be passed through!

We are considering reintroducing the original signature methods but with different semantics; instead of return a clone of the global configuration we can return a fresh configuration object populated with default values so developers can be sure about what configuration they get!

To wrap up the session on configuration I'd like to present a short "cheat sheet":

Emdedded Old
Db4oFactory.OpenFile("dbfile");
New
Db4oEmbedded.OpenFile(
   Db4oEmbedded.NewConfiguration(),
   "dbfile");
S
e
r
v
e
r
Old
Db4oFactory.OpenServer("dbfile", port);
New
Db4oClientServer.OpenServer(
 Db4oClientServer.NewServerConfiguration(),
 "dbfile",
 port);
C
l
i
e
n
t
Old
Db4oFactory.OpenClient(
       "dbfile", 
        port, 
        "user", 
        "pwd");
New
Db4oClientServer.OpenClient(
 Db4oClientServer.NewClientConfiguration(), 
        "dbfile", 
        port, 
        "user",
        "pwd")

ExceptionsOnNotStorable is turned on by default

That's (IMHO) really nice. I don't like to just pretend that classes are storable on Db4o and let customers struggling trying to figure out why their applications doesn't work when we could follow fail fast principles and let they know that one or more classes may have problems as it is.


Use of properties in .Net

That's mean more natural code style for .Net developers :). Now, instead of saying:

config.OutStream(Console.Out);

you will write:

config.OutStream = Console.Out;

We are aware that there other places where using properties instead of methods (or even using a different approach) would make more sense (on .Net of course) but we just don't have the time to improve them now. But you may be sure we'll do our best to keep improving both .Net/Java developers experience.


That's it!

See you.

Nov 5, 2008

Are you a C# developer?

If so, you should go and grab a copy (for free) of CodeRush Xpress for Visual Studio!

(I already own a copy of another addin, but I'll give it a try anyway :)

Adriano 

Nov 2, 2008

PDC 2008 Videos - For free!! :)

Hi.


Are you a Windows developer? Or simple a Windows enthusiast? So you probably is aware of Microsoft PDC 2008. 

I'd love attend it but I couldn't  :(

At least we can grab (all?) Microsoft PDC 2008 Videos.

Have fun!

Adriano

Benefits of working from home - Part VII - Alone in the office

With this post I'll stop talking about the advantages of working from home and start to discuss some of the drawbacks related to this way of work.

(sorry for the subject, I just couldn't resist :)

Note that some points that I first took as an advantage may appear again, but this time, with a focus on possible disadvantages; this doesn't mean I've changed my mind (what I would say is perfectly normal); its just
the other side of the same coin.

I'll start with the most problematic one (at least in my case), working from home meant to loose almost all contact with my friends and coworkers. I remember it perfectly when I was being interviewed (through skype) and I was asked how I felt about working alone, 8 hours per day; honestly, at that moment I did think it would not be an issue, but sometimes it is a little bit lonely.

Since I was not bound to an office anymore, after 4 months we (I and my wife) decided that the time to move to a quieter, safer, less violent place had come, so we moved from São Paulo to Londrina; you see, most of my friends still live in São Paulo and even having some (good) old friends (and my wife's parent) here in Londrina I somewhat miss personal contact.

Another important aspect of working from home is that all discussions (at least in my case) are done through some IM software (be it skype/msn/etc) and this is considerably harder to do than when you are engaged in a face-to-face talking.

It's enough for the first "not so good" series... let me play a little bit of "Star Wars" on my Wii ;)

See you.

Adriano