Wednesday, May 23, 2007

Resharper Jedi

Reading the blogs from some guys that went to DevTeach, I've learned a new term that emerged (I think) from there, "Resharper Jedi".

Oren (Ayende) seems to be the official Resharper Jedi, elected by the guys during DevTeach. In his Hibernating Rhinos series you can see how fast he uses a lot of features from Resharper.

In my teams I try to convince every developer to learn at least the most important Resharper shortcuts, it really really improves the programming speedy. I personally rarely use a mouse inside visual studio due Resharper features shortcuts.

I cannot imagine myself using Visual Studio without Resharper anymore; it seems only a text editor with an integrated compiler/debugger. However, I'm happy with VS + Resharper, but I still would like a "JetBrains IDE for .NET", kinda "IntelliN".

Talking about Resharper, I just found a new blog from a JetBrains' developer about Resharper. It looks like a nice blog:

Sunday, May 13, 2007

Fast system <> real time system

Why a lot of people think that systems that have fast response are "real time" systems? I often hear things like "It's a real time system, the values are constantly updated in real time.", "It's a real time system, it responds immediately after it receive a request". Real time is about compromise to give a response in a window of time, I mean, the system has to produce a response in x seconds, no matter what, it has to produce it in x seconds, point. A formal definition from

A Real-Time System responds in a (timely) predictable way to unpredictable external stimuli arrivals. In short, a Real-Time System has to fulfill under extreme load conditions:

  1. Timeliness: meet deadlines, it is required that the application has to finish certain tasks within the time boundaries it has to respect;
  2. Simultaneity or simultaneous processing: more than one event may happen simultaneously, all deadlines should be met.;
  3. Predictability: the real-time system has to react to all possible events in a predictable way;
  4. Dependability or trustworthiness: it is necessary that the real-time system environment can rely on it.

Common examples of real time system are: automobile airbag systems, temperature control system of a nuclear power plants, etc.

In one of my current projects we have to control PLCs for pallets transportation in a warehouse, we have to reply the PLCs quick, otherwise the efficiency of the warehouse goes down, but it's far from being a real time system, even so I bet someone (colleagues, partners, client, providers, etc.) will call it a real time in some moment in the future.

The majority of systems people call real time are .NET or Java (not JSR-001/JSR-282) systems. However, the garbage collector in .NET and Java is not deterministic, so you cannot be sure about when some things will happen. For this reason, you cannot build real time systems in .NET or Java, at least not a “hard” real time system.

With JSR-001/JSR-282, Java will be able to build hard real time system; however, I've never saw anything similar for .NET, unfortunately.

Wednesday, May 9, 2007

My default .NET data access strategy - NHibernate based approach

In my new project I and my team are being able to use a set of tools that I have been looking at for some time for data access in .NET. The approach is based on well know open source ORM framework: NHibernate, however, we are using other fantastic tools above it.

Instead of creating NHibernate mapping files, we are using Castle Active Record (AR) attributes to decorate our domain model classes. Analyzing the attributes AR can generate the mapping files dynamically, so we don’t have to deal with a lot of xmls files. We have something like this.

But we also don’t create the domain model directly, we use the Active Writer, which is a VS add-in that works like VS Class Designer, but it generates classes decorated with the AR attributes. So, it’s very fast to create a full domain model mapped using the AR attributes.

However, we don’t use the ActiveRecordBase class as base class for our model in order to avoid getting the persistence methods in our domain model. We prefer to use repositories (DDD flavor).

For the repositories we use a slightly modified version of Rhino Commons ARRepository (generic specialization). The implementation uses the ActiveRecordMediator which already have most of basic persistence operations, such as Save, Delete, FindAll, FindOne, etc.

For custom queries, we try to avoid using the NHibernate query API directly; instead we use the Ayende’s NHibernate Query Generator tool. It allows us to have strong typed queries that feels like SQL Queries, much better/natural in my opinion.

So, we have something like this in the EquipmentRepository:

Equipment FindDougEquip()
return FindOne(Where.Equipment.Name == “DouglasEquip” && Where.Equipment.Id > 0);

Well, I think this approach is very productive; we have a full persistable domain model and basic repository classes, besides the strong typed queries in few minutes. Really really fantastic open source tools.

Monday, May 7, 2007

First post - Introducing myself

Well, this is my first post so I think it would be a good idea to introduce myself to anyone who could find this blog or even read it and don't know me yet.

As you can find somewhere in this page, my name is Douglas and I'm from São Paulo, Brazil. I'm an Electrical/Computer Engineer graduated at Poli-USP. I work as a Team Leader at Chemtech, an industrial services company from Siemens group. I usually work at São Paulo office, mainly in software development projects for a range of industries such as metals and mining, logistics, water and electric power, etc. Chemtech is a really nice place to work, I'll post about it in the future.

I'm a huge fan of modern/agile software development practices like refactoring, continuous integration, TDD, DDD and techniques like IoC/DI, ORM, AOP, etc.. Most of my projects uses .NET platform (my favorite), but I already did some huge projects in Java EE world, which I like as well.

I'm always looking for great tools, whenever possible, open source one. In .NET world I (and my teams) use a lot of them, such as Castle Project stack (Windsor, Active Record, Active Writer, Dynamic Proxy), NHibernate, Ayende tools (Rhino Mocks, NQG, NQA, Commons), Cruise Control .NET, NAnt, NUnit, etc.. While JetBrains does not create a kick ass .NET IDE, I use Visual Studio with its fantastic Resharper add-in. In Java world I use the similar ones.

I'm also very interested in project management, I like to compare and merge/use whenever possible agile practices such as Scrum and XP with PMI PMBoK guidance in my projects.

Well, so it's the end of my first post. In the future I'll post more about my life in software development industry and other random stuff.

More about me in Linkedin: