Those little things that trips you
There is a message in Boo about the problem of allowing assignment in conditinals:
doSomething()
I liked the way Christoph pharsed the issue: Now even if you don't notice this yourself, at least the compiler will warn you, thus saving you from hours of tedious debugging. (Ok, maybe I am exaggerating, but let's assume the worst case.)
One thing that I noticed that when I'm developing, most of the time is not dedicated to design or writing code, it's dedicated to those little problems that I run into. For instance, I mistakenly defined a one to many relationship as a serialaziable relationship (meaning that the class is serialized to a BLOB in the DB). I wasted hours on that thing, until I finally looked at what was happening and it hit me. Another thing was the associtaions, which took a while to resolve.
Right now I wasted a lot of time on trying to get Subverion merging to work. There is a lot of documentation about it, but I do it for the first time, so it's a "learning experiance"*. How much time do you find yourself dedicate to those side-tracks, those implementation details? Any suggestions on how to reduce this?
* Nice figure of speach to banging my head on the wall :-)
Covariance Without Generics
A few days ago I asked why you can't treat IList<String> as IList<Object>, Wesner Moise commented with the explanation, and Mitch Denny has a post with a fuller explanation. One interesting thing that came up via a comment from Tomer Gabel was that the following code is legal:
static void Main(string[] args)
{
object[] array = GetList();
array[2] = 1;
}
public static object[] GetList()
{
return new string[10];
}
This suffer from exactly the same problem that you get with generics. In fact, while the code compiles, trying to run it results in ArrayTypeMismatchException. I never dug deep enough into the runtime so I could tell you how arrays are implemented, but I think that they are just getting special threatment from the runtime. Any Rotor hackers out there that can comment on that?
Rules, Delegation, and Yielders, oh my!
Like I said, I've just wrote a rule that used pretty much all the new features that C# 2 has to offer. I'm aware that I tend to like new things for their own sake, but I like to think that I'm using them wisely. Let's take an example, since this is the best way to do it, in my opinion. I present here a case similar to the one I ended up with, and I would appreciate comments about the readability / maintainability of the code.
I have a graph of objects, and I need to run various rules against it. Traversing the graph is trivial, but I usually need to do it while taking all sorts of things into account. In this case, I basically need to compare the two, and generate notifications (using yield return) based on what is going on there. Let's see an example, and then I could talk and be pretty sure that you understand what I'm talking about.
First, let's take a relatively simple scenario that bring this and several other concepts that I've talked about earlier. The scenario is simple, we have a context under which we operate, and we need to apply similar rules to different contexts. Most of the rules operate on time, for example: A store must sell at least 50 items a day.
It's a simple rule, isn't it? But the stores doesn't hold the data in a daily format, they hold a list of sales, and each sale has its associated date. The sales are already sorted by date, so it's should be very easy to do it, right? Well, it is, if you don't have a day without any sales. Does it trigger the rule? That depends, if it's a day that the store was closed, it wouldn't, but if it was opened and didn't sell a thing, there is probably something there that needs more attention. What happens if you want to run the rule with a granularity of a week? A month? A quarter? What happen if the rule has a granularity of a month but the data we has is only for a week. This get messy very fast.
At the end I decided that I would create a class that would encapsulate all those decisions, and that class would use the context to get the various options it needed (for instance, when the store is closed). Here is what I ended up with. Pay attention to GetItemsOnSameDay() and GetItemsOnSameWeek(), that is where the crux is happening.
{
Context context;
Convertor<ISalesContext, int> action = DefaultAction;
public StoreWalker(Context context)
{
this.context = context;
}
private int DefaultAction(ISalesContext salesContext)
{
return 1;
}
public Convertor<ISalesContext, int> Action
{
set
{
if (value==null)
throw new ArgumentNullException("value");
action = value;
}
}
public int Walk(Store Store)
{
int count = 0;
foreach(ISalesContext salesContext in GetItemsOnSameDay(Store))
{
count += action(salesContext);
}
return count;
}
public IEnumerable<ISalesContext> GetItemsOnSameDay(Store Store)
{
IList<Sale> items = new List<Sale>();
DateTime currentDate = Context.Start;
foreach(Sale item in Context.GetItems(Store))
{
while(currentDate != item.Date)
{
yield return new SalesContext(items, currentDate);
items = newList<Sale>();
currentDate = currentDate.AddDays(1);
}
items.Add(item);
}
while(currentDate != Context.End)
{
yield return new Store(items, currentDate);
items = newList<Sale>();
currentDate = currentDate.AddDays(1);
}
}
public IEnumerable<ISalesContext> GetItemsOnSameWeek(Store Store)
{
IList<Sale> items = new List<Sale>();
DateTime start = Context.Start;
foreach(ISalesContext salesContext in GetItemsOnSameDay(Store))
{
items.AddRange(childStore.Items);
if(salesContext.Date.DayOfWeek == DayOfWeek.Sunday)
{
yield return new SalesContext(items, start, salesContext.Date);
start = salesContext;
items = new List<Sale>();
}
}
}
}
What GetItemsOnSameDay() does is to return provide a way to iterate over a store, and make sure that every day is accountable to. The GetItemsOnSameWeek() builts on GetItemsOnSameDay(). I can very easily add methods that would make the calculations for a month or a quarter, and they would be simple, since they wouldn't need to check for missing weeks or months.
The nice part about it is that the whole thing is lazily evaluated, so if you're running it on large amounts of data, there is no need to build the graph and then run on it, you run on the graph as you go along, and then the objects are GC'ed. However, I'm not sure what the implications of this are performance wise. There are some problems with recursive iterators that you should be concerned about if you're using it for large data sets. I don't think that this apply here, as it's not about blindly forwarding methods calls (as in the case of the recusrive iterators), but each iterator in this case does work on each own, and it make it conceptually much easier to understand the system.
The more esoteric stuff comes later, when you need to run the rules over a store. If I was using .Net 1.1 or Java, I would need to use the Template Method, and for each rule that I would need, I would have to create a sub-class of StoreWalker and put the things that I need to check there. I find it limiting because most of the time I only need a couple of lines to express the difference, and I only use it in one place. I choose to go with Generic Template Delegate.
How do we find out how much items was sold from the store?
{
StoreWalker sw = new StoreWalker(Context);
sw.Action = delegate(ISalesContext salesContext) { return salesContext.Sales.Count; };
return sw.Walk(Store);
}
How do we find the busiest day? This one uses local variables, so it can "remember" the current maximum is.
{
StoreWalker sw = new StoreWalker(Context);
int max = -1;
ISalesContext maxSaleContext;
sw.Action = delegate(ISalesContext salesContext)
{
if(g.Children.Count>max)
{
max = salesContext.Sales.Count;
maxSaleContext = salesContext;
}
return 1;
};
sw.Walk(Store);
return maxSaleContext == null ? DateTime.MinValue : maxSaleContext.Date;
}
Total number of sales?
{
return new StoreWalker(Context).Walk(Store);
}
I chatted with Oren Ellenbogen about this, and he claims that the maintainability of the code is compromised. The idea is that it would cost you five minutes to do it the old way (using Template Method), and then it's more maintainable. I argued that while this does require a shift in thinking, it pays off very shortly by using these type of techniques. I certainly don't advocate putting a large method inside an anonymous delegate, but even if it's a complex calculation that you want to do, you can still get the benefits of merely writing the method and then wiring to the walker's action.
Thoughts?
A study in unusability
VS 2005 has a great concept called snippets. It's a wonder it didn't have it before, since it's a very basic item, but at least we got it now. There is a community site where you can get snippets from the community.
All in all, I think that this is a laudable idea, but I find the implementation problematic.
Take a look at the site, it's a very clean UI, and you can see the last 5 entries. This is well and good, but I couldn't figure out how to get anything else. I consider myself pretty handy in computers, and this is just incomprehensible. Maybe they read Scoble's posts about search and took it too far?
I want a list of categories, or even a flat list. I want to browse the site, not search it. I would've been disappointed if they wouldn't have search, but having a search with magic pharses (see "recent 5" on the front page? "recent 50" doesn't work) is just useless.
Know those associations
I just had a
run into a mess of my own cooking. I had a set of classes, where one class held
references to some other classes, and I didn’t map the associations
properly. Not in the software and defiantly not in my mind.
Enter a lot of frustration about WTF is going on here.
I didn’t map all the associations and their cascades,
which meant that I run into a lot of trouble when I started to really work with
the model. Luckily I’ve a suite of tests that I can run, so I can play around
with the cascades and see what is going on.
To add to the problem, I tried to do two things with it, the
first was to follow the business logic and create associations that would make
it easier to work with the objects. The second was to allow a to clear the
database for the tests.
This got me into a lot of trouble…
I couldn’t use NHibernate to do it, because it failed
to do a mass delete since the associations and cascades where in the way. At
first I tried to work around that, but pretty soon it became clear that it’s
not going to be possible.
I finally decided to separate the two concerns. I have not
problem with having testing hooks, but changing the business logic because you want to have easier
testing is a symptom that you went a long way too far.
I restored the association to the way they were supposed to
be according to the model, and I’m going to keep an eye on that, I didn’t
really paid attention to that before, and it’s going to be critical in a
few days, when I start to put it all together.
For the tests, I’m using a simple function that
deletes all the rows from the database after each test. On the first time that
the tests are run, the whole database is recreated from scratch.
I’m not using Active Record to do it, since other
tools need the schema as well, and I want to make sure that I don’t make accidental
change to the schema by messing around with the business objects.
Still working on the rules, now it’s a rule that is a collection
of rules. This one had me using just about any feature of C# 2 to get it done
cleanly. I’ll post about it later.
Free as a bird? Or not?
This slashdot story made me smile. A software bug set inmates free early and late, some by nearly half a year!
I used to be the commander of a high security prison, and I understand how those systems work. What I find interesting is the number of check and balances that most prisons have. I'm familiar with the inner working of most prisons in Israel, both military and civilians, and it's hard to believe that you would get a case of this proprotions.
One case might happen, but then all hell would break lose.
In any case, I find it very hard to believe that the inmates do not know when they are to be released, and while they might not speak if they are released early, they would definately speak if their due date has come and they are still inside. I never knew an inmate that didn't know to the day (and usually to the hour) how long he was inside, and how long he still had.
I remember having to go over all the inmates files weekly, checking that all the documents were in order, and that the computer system* was correct. I find it hard to believe that they didn't have any kind of human intervantion. I know that when I released an inmate, I went over all the paperwork twice, because you don't play around with this kind of stuff.
* A glorified name for Excel sheet.
Covariance in delegates
I'm not sure if it's the way to call it, but why does the C# compiler errors on this:
{
return new List<string>();
}
Seems to me that a generic of a derived type should be able to satisfy the compiler when requesting a generic of a base type.
Any idea what the reasoning behind this decision was?
TDD and SQL Express
Testing against a database is usually a problem, but I run into an unusal one today. My tests would all fail, saying that they couldn't connect to the database. I checked the connection string, and then try to connect using VS 2005, and it worked. When I run the tests again, they got the database and run properly.
The only thing that I think of that can cause that is if SQL Express wasn't running when I run the tests the first time, and when I accessed the database in VS 2005, it checked for that and started the database.
Strange...
Rhino Mocks 2.4.2: The Unmocker
Okay, so I've a new release out (any time I push out a release, I just know that I'll have to have a new one ready in a short time).
So, what is the story here?
Some time ago I added the ability to easily create stub objects and dynamic mocks. So you could do something like this:
IList list = mocks.DynamicMock<IList>();
SetupResult.For(list.Count).Return(5);
mocks.ReplayAll();
//use list, list.Count will always return 5, anything else will return 0 or null
This works fine and I use it daily in my current project, but it's a problem where you get cases where you have a property on your mocked object, let's take this code:
public int SetId(Something something)
{
something.Prop = // Get the id
return something.Prop;
}
Now, what do you need in order to connect the setter and getter in this case? Well, before 2.4.2 you needed to know about the value beforehand, which was not always possible. Here is how you do it on 2.4.2, however:
[Test]
public void TestSetId()
{
Something something = mocks.DynamicMock<Something>();
SetupResult.For(something.Prop).CallOriginalMethod(); // for the getter
SetupResult.For(something.Prop = 0).CallOrigianlMethod(); // for the setter
Assert.AreEqual(5, objUnderTest.SetId(Something));
}
What do we have here? We create the mock object, and then we setup two calls, one for the property getter and another for the setter (the syntax may be a little weird for the setter, but it's actually the best syntax that we could think of). We tell Rhino that when it get a call to get_Prop, it should just call the original method on the object, and the same for set_Prop. That is a nice way to do it, I think.
Caveats:
- There is no either/or with this, it doesn't attempt to match arguments to see if it should call the original method or not, it just does.
- You can't set repeats or exceptions or return values, any call for this method will go to the original object.
- You can't use it on interfaces or abstract methods, since there isn't a method there to pass it to.
Taking Rules to Court
It's about time I'll post about my trouble making rules again. I've been doing some DATT* work on them, and I got to the point where I can write a rule in an hour or so (including tests, of course), instead of a day.
Partly it is because I'm now using Fitnesse to write the tests, which allows for a very nice way to declare rules and various states and then test them. I'm not sure if the problem is with what I'm doing or the way I'm doing it, but when I wrote the tests in C# I got a lot of tedious initialization code, one method call, and a lot of verfication code. Using Fitnesse I'm able to express that in a natural syntax:
| create rules | |||
| create employee | ayende | ||
| add employee rule | coffee breaks every | 3 | hours |
| coffe break | |
| employee | coffee break time |
| ayende | 13:00 |
| ayende | 14:00 |
| ayende | 17:00 |
| ayende | 20:00 |
| validate employee | ayende |
| can't take a coffee break on 14:00, take another on 16:00 | |
| what are you doing working on 20:00, go home! | |
It takes about ten minutes to write that, including the code that makes it run, and it's very malleble to change, so I can very easily create new test cases, or modify existing one. Fitnesse is usually used for acceptance tests, and I can certainly see why. The problem in testing rules is that almost by defination, they are first and foremost business concerns, and they usually need something to run on, which mean a lot of state to setup.
There are some patterns about dealing with that, but I found that Fitnesse is easy and add a lot to the fun. This week the FitLibrary for .Net should be out, which will make it even better.
* Design All The Time
Reading the license...
I just re-read the license that I've on my site. It started by being the standard BSD license, and I simply removed the ALL CAPS from the no warrany clause. Now, I don't go around reading licenses very often, especially not mine, but I made some (minor) changes to the site, so I was browsing around randomally and happened to read it.
Check it out:
I know that I didn't put it there in purpose, and I can't find anywhere else that had this mistake. It's fixed now, but it's strange...
Getting ready to .Net 2.0, choosing an IDE
I'm currently doing a big project on .Net 2.0, you might have figured that out because that is about all I talk about lately. I did a short code review for myself recently, and I noticed that I used just about every new feature of C# 2 that came out short of partial classes (and they would be used on the UI).
Of the top of my head, here are the features of C# 2.0 that I love:
- Anonymous Delegates - I really hope that whoever it is who is going to maintain my code can wrap his head around it (I know that some people have problems with that), because I use it is cool, fun, and saves a lot of work. I just love it.
- Iterators - This is a really cool way to run over an object graph. It's really simple on both sides of the code. The one thing I regret is that there is no way to do some sort of lazy sorting, but that is mathematically impossible to do anyway.
- Generics - They are cool, save a lot of typing, but not really exciting except in what they
- #pragana warning disable - Very useful to tell the compiler, I know what I'm doing here. Currently I'm using it to shut some warnings about unused fields that I'm setting via reflection.
- sealed classes - It's good to have an easy way to do it.
Of the top of my head, here are the features of VS 2005 that I love:
- Slicker UI
- Some refactoring support (but not as good as ReSharper).
- Ability to edit / view the database directly from the IDE.
All in all, I'm not very impressed with all the new abilities of VS 2005. I'm sure that they demo nicely, and you can probably show me some stuff that will evoke a Wow! out of me in some areas, but I don't see the big improvement in the IDE that I expected to. It is very annoying because you can see that they almost got it.
One thing that I really like is the code coverage for unit testing, when you activate that, you can see what parts of the codes were visited. This is a killer feature, but I can't figure out how to use that with NUnit, and I can't use VS Unit Test framework because that one is totally unsuitable for tests.
There was some discussion today about the pricing for VS 2005, so I headed here to check it out. I think that I (personally) think that I'll either goes with VS.Net Standard, since this gives me most of the nice features that I need, at only slightly unreasonable price ($300). The problem with that is that this doesn't include MSDN subscription. Getting that means shelling out $ 1,200 which is a lot to me.
So far I have done wonderfully by using a $90 VS 2003 Standard, but I keep hearing about all those new stuff that are avialable to MSDN subscribers only... I think that I could be very happy with C# Express, except for the little fact that it doesn't support add ons. I can't see myself living without ReSharper and TestDriven.Net.
I'm currently trying out Sharp Develop 2 (from the subverison repository), and while I think that it's a great effort, past experiance shows that it's not quite ready for prime time. Even if I would decide to go this way, I would still need ReSharper. Another option altogether is to wait for the JetBrains .Net IDE. Considerring my love for ReSharper, I may even save some money on this one.
Any suggestions from people who already made this decision?
Should you beware of the utility base class?
What do you think about a base class that doesn’t
offer any business value to an object, but provide services? By that I mean a
base class that takes care of persistence, validation, etc.
I just run into a situation where I’ve such a class, but
I don’t want some of my classes to use it. The problem is that this
happens in the middle of the hierarchy. Here is the scenario:
- Rule – Persisted to database
- Built-in Rule – Not persisted to database
- Lots of Rules – Persisted to database
Rule inherits from a base class that handles the persistence.
Most of the rules are persisted, but the built in ones always exist. What I needed was a way to do multiply
inheritance, so I could have this hierarchy:
- Rule – Not persisted, provide common interface and
services
- Built-in Rules – Not persisted.
- Persisted Rule – Inherits from Rule and the persistence
class
- Lots of rules
You can’t do that in .Net (which is a shame).
Right now I’ve a situation where a built in rule looks like it can be persisted, which I
don’t want to happen. Any suggestions?
Continuing a meme: What makes a good developer
Matt asks what makes a good developer?
- Lazy - And willing to go to great lengths to be lazy.
- Tinkerer - Willing and able to take peeks beneath the surface.
- Aesthetic - Appriciate a good and elegant solution and actively works to get to it.
- Passionate - See this as more than mere work.
On the bookshelf...
After a very long time (or so it seems), I'm done reading Patterns of Enterprise Applications :-)
I already talked about why I found it interesting. Highly recommended, although it would blow your mind if you read it too quickly.
I'm going through my Amazon orders history, and I'm amazed at the amount of books I read in the last year. I blogged about most of them, but the amount is really big when you look at it all together. On the other hand, I've books from 2004 (december, though) that I've yet to read. I had PoEA since January 2005, but I got to reading it only now.
Here is a list of what I still has to read:
High priority books:
- Data Access Patterns: Database Interactions in Object-Oriented Applications
I'm not sure what I'll get from this book, as I'm completely ORM guy now. But nothing that has to do with data is ever going to waste :-) Another book that I've for a long time. - The Design of Everyday Things and Emotional Design are two books about designing physical objects, but they come highly recommended for anyone who needs to do UI and needs to understand more than just the surface.
- Peopleware : Productive Projects and Teams, 2nd Ed.
A book about process and management, one of the books that everybody recommends. - AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis
Partly for the horror factor, partly to preper to battle those monsters. - Best Kept Secrets in .NET
Full of tricks, some of which I already know, some of which I don't care to know (all the dataset stuff), and some I probably need to know :-)
Books I've started reading but didn't finish:
- UML Distilled: A Brief Guide to the Standard Object Modeling Language, Third Edition
I usually devour any of Fowler's books, but I just couldn't find enough interest to keep reading this one. It's all about boxes and arrows and what a full arrowhead is compared to an empty arrowhead. Perhaps it is because I never had to write any UML and any time I tried it was highly frustrating... ? - Virtual Machine Design and Implementation in C/C++
This one I've since 2002, I think. It's a good book, and it certainly delivers what it promises... But the book is about a very simple virtual machine implemented in C++ that I could see nothing special with. It certainly cleared my mind about a lot of stuff, but I still think that a great opportunity was missed here. I would be more interested in reading it if it dealt with issues such as garbage collection, JIT, etc. Instead, it's just an assembly language and a virtual CPU. - Understanding the LINUX Kernel: From I/O Ports to Process Management
I read half way into this book until I got bored with following low level C code. It's not hopelessly out of date. - Beginning Direct3D Game Programming and Beginning .NET Game Programming in C#
My mind just can't wrap itself around 3D math right now. I fully intend to get back to it when I can actually understand what they are talking about. - Enterprise Solution Patterns Using Microsoft .Net: Version 2.0 : Patterns & Practices
Can you say boring. I couldn't bring myself to read this to the end. It's a bunch of stuff that I read elsewhere, mostly presented in a very boring way. - Build Your Own .NET Language and Compiler
This book has the privilage of being the only one I put down on account of code style. It's a VB.Net book (and I'm a C# guy, if you didn't notice), but that wasn't what made me put it away. It was hungarian notation in VB.Net in 2004! It was very bad code and totally lame implementation of the compiler. Yuck!
Upgrade to Cuyahoga 0.9
Note: This is an online report, which means that I'm writing this post as I'm upgrading.
I downloaded the binary distribution edited the web.config to point at my database and then copied the directory to the server, overwriting everything there.
In retrospect, I'm not sure this is very wise, since I can't remember how I change the default look and feel of Cuyahoga. OTOH, I have it on a backup, so that is not a big issue.
I'm copying via SmartFTP's threaded queue. One thing to notice there is that there seem to be be problems if you try for really high number of threads (25 and above). The problem doesn't seem to be in SmartFTP itself, but on the server, and it's related to locked files. I'm not sure what is wrong there, but I'm currently using 10 threads to upload, and it seems to be working fine.
This version of Cuyahoga should offer some performance gains (mainly because of the upgraded version of NHibernate) and fixes some problems with regard to over-eager caching.
Hm, it looks like SmartFTP didn't copy the Bin directory. That is strange, I'll copy it manually.
Okay, that worked, and I got the nice installer that upgraded my database. I still got some problems with regard to the positioning, it was a bug in Cuyahoga 0.8.2, which I think has to do with deleting sections, but it should be fixed now. It doesn't automatically fix the problem, though, and I had to go and fix that manually.
There wasn't any problem with my layout, seems that I created a new template instead of overwriting an existing one. The one problem I'd is overwriting the orange RSS image with a blue one, and that took a second to fix.
I needed to upgrade the downloads module manually. There used to be a bug where downloads would sometimes freeze midway, I hope that is fixed.
Upgrading the site
I'm going to upgrade the site to Cuyahoga 0.9 in a couple of minutes, this may affect the blog as well.
I'll post about the process when I'm done.
Book Review: Knife Of Dreams
Damn! But Knife of Dreams is a fine book!
I read it in one sitting, of course, after waiting so long for it, I just couldn't bear to do it by halves. It's everything the Wheel Of Time fans could hope for.
There is a lot of action. Things that were building for the last three or four books are finally coming into light. The entire book is very fast paced, and it managed to close a lot of plot lines. It's an amazing book, I just couldn't put it down.
I don't want to spoil the surprise for anyone who hadn't read it yet, so I'll just say these things:
- Plot lines from previous books are closed left, right and center.
- I can't off hand think of any big plot that started in this book.
- Things that were setup years and years ago finally come to fruitation.
- The characters actually explain some of the things that they are doing. It was a constant annoyance in previous books, where you would see a character behave in a completely unlogical way, and you sometimes couldn't figure out why.
- The Last Battle is Close - and RJ said that there is only one more book!
- There is a lot and lot and lot of action.
- No more setup!
This is the impression after reading it once, I'm going to read it a few more times, probably.
Well, I'm now off to read the newsgroup, I'm so glad that I didn't give in and read the spoilers.
The 9th level of indirection
I’m
having fun using Fitnesse to test my code,
but I just got an exception from the bottom of the stack on one of my Fit
tests, and I started to think about just how many layers I’m using there.
In order to be able to complete the tests I want to write (business logic only,
mainly), I’m going to:
·
Create a set of
fixtures to translate from Fit tables to my model.
·
Create an
abstraction on top of Fit that make it looks like the database it used.
·
Mock several parts
of the implementation for the Fit tests (parts that I don’t really
control).
·
Mock the database
layer for ActiveRecord..
With so many levels of indirection, I’m afraid that I’ll
tests my mocking, and not the business objects J
I started to mock the database, but I soon lost myself in
the details. I think that for now I’m going to just use the database
(after all, Fit is supposed to be
all about acceptance tests.)
One more thing to consider if you’re going to use
Fitnesse for your tests, learn to love the Debugger.Break(),
it will helps you out of situations you can’t understand how you’ve
gotten yourself into. One word of warning, most of the documentation for Fit
and Fitnesse is about the Java version, and the .Net version lacks some
abilities that would make working with it much easier. Specifically, I’m talking
about the FitLibrary for .Net.
I’ve been able to create a fixture that would be Good
Enough ™ for my needs, so it wasn’t that much of a problem for me.
Implementing Fowler
I’m
currently reading Fowler’s Patterns
of Enterprise Applications, and I’m very slightly bored. Not because
of Fowler’s writing, of course. It’s just that he doesn’t
seem to talk about new concepts for me. When I read his Refactoring book, I was
thrilled; there was a lot of new stuff to learn. But reading PoEA
is a different matter. I don’t learn many new stuff, but rather I see
more clearly what is going on in the tools that I’m using.
When he talks about Active Record, I get better understanding
of the advantages & disadvantages of using Castle.ActiveRecord.
When he talks about Unit Of Work and Data Mappers, I suddenly see why NHibernate is doing this or that, and I
can see ways I can take advantage of it. I’m currently reading about MVC
in web applications and about Page Controller vs. Front Controller and I keep
thinking about MonoRail and the way it does things. The problem of Template
View vs. Transform View vs. Two Step View came up in the Castle developers
lists twice in the last month.
I can’t wait to get to the parts where I don’t know anything (Optimistic
Offline Lock, for instance). Great book. It’s clearing a lot of design decisions
for me. It’s surprising how much of the things he talks about are
implemented in Open Source Software that makes the patterns accessible for
anyone.
One thing that surprised me is that doesn’t seem to be
any discussion of security in any way inside the book. I’m pretty sure
that there are patterns for securing code beyond not using strcpy(), any one
can recommend something?
I shuffled through Writing
Secure Code, and it’s mainly talks about low level things, highly
important, yes, but not very helpful when you’re trying to design your
application security. I’ve the first version, so maybe the second version
fixes that.
Anyone has a recommendation?
Done!
Running as hard as you can...
just to keep yourself in place.
I finished answering all the mail and checked RSS Bandit, 307 unread posts. I'm down to 148, but I don't think I'll finish today...
Rhino Mocks 2.4.1 Broken
I would like to apologize for anyone who downloaded build 2.4.1, it was broken, the dynamic proxy wasn’t merged properly. I would also like to thank David for reporting the problem. I was offline for the last three days, so I wasn’t aware of it.
It’s fixed now both in the repository and in the site, just re-grab 2.4.1 and it will be fine.
What 3 days offline can do
I was offline for the last three days because of Yum Kifur and because of hardware problems that I was having. Officially, I'm still offline, since I can't get the network in my house to work, and I'm surfing directly via the modem, and not via the router, as usual.
Anyway, I just opened up Outlook & RSS Bandit. The damage is 142 non spam emails, and 253 blog posts to go through..
Ouch.
Network down, and so is the support
I’m writing this on Wednesday, 15:20 PM, a couple of
hours before Yum Kifur.
For some unknown reason, I don’t have any internet
connection. I wanted to setup a couple of long running downloads, but that
doesn’t seem to be allowed L. The support
centers are all empty by now, so there isn’t anyone to talk to.
Easy fast and a big sorry for everybody whom I’ve hurt
last year.