Not
exactly the message that I like to get from my source control repository.
Eber Irigoyen has a post about what should I hide?, based on advice from Code Complete 2. Eber is making the statement that the question should be reversed. What should I expose?
On the face of it, it looks like a reasonable suggestion, after all, I assume that we all accept that encapsulation is a good thing. The problem is that this completely ignore the notion of extensibility. It only give you the extensibility that you think of ahead of time. For examples of where this approach fail, just look at caching & batching in .Net. In both cases, the approach of show just what you must is used, and this make both completely useless for any scenario that you didn't think when creating the code.
Ten
Neward has posted a long post about OR/M - The
Vietnam of Computer Science. The first part of this post is a Vietnam war history
lesson, and I kind of missed the point, then he goes on to point at various
issues with OR/M.
I
don't quite get the point of the post, to tell the truth, and I am tempted to raise Godwin's Law in this
matter
He
raises some valid points, but each of those issues are already mostly solved
issues.
To
give some examples:
- Entity identity vs. Row Identity –
Identity maps and Unit Of Work handle this issue.
- Concurrency - Last Write Win, Optimistic Concurrency,
Explicit locking.
- Caching across a web farm – Use a distribute
cache.
I the last week I was asked multiply times about using Rhino Mocks to mock interfaces with generic methods.
At the moment, this is not working, the code needed to generate generic methods on runtime is not trivial, and I tried fixing it several times, without success. Currently, Dynamic Proxy 2 is being worked on, which will have support for generic methods, so I expect to have this feature soon.
The following hack will get you by for now, it is not ideal, but it is what I have at the moment.
The ISession interface from NHibernate contains a generic Load<T>(object id) method, which measn that Rhino Mocks can't mock it. Here is how we solve the issue:
public abstract class SessionWithoutGenerics : ISession
{
public override sealed Load<T>(object id)
{
return (T)Load(typeof(T), id);
}
}
We basically disable the mocking of this specific method, and now we mock this class, and continue life as usual.
This is not only one of the nicest logos that I
have seen, it is also the logo of Rhino Mocks
Boo Macros, which is a language extension
for Boo that integrate Rhino Mocks directly
into the language.
Andrew Davey released it today, and it completely blew me away.
I did some Boo hacking, and I have a fully appreciation of the scale of the task that Andrew had.
Check out how simple it looks:
[Test] def
Example(): record
mocks: foo
as
IFoo
=
mocks.CreateMock(IFoo)
expect
foo.Dog(int,
x
as
string,
y
as
int): x
[
Is.NotNull()
]
y
[
Is.GreaterThan(0) &
Is.LessThan(10)
]
return
42.0
verify
mocks: foo.Dog(0, "hello", 5) |
The above example creates an expectation for a call on foo.Dog(anything, not-null, between 0 and 10), and then make the call. There is a lot more documentation here.
Very nice and simple to work with.
Congratulations, Andrew, and very good work.
I know that I’m usually critiquing Visual Studio, but
I was working in VC++ today, and I had several Wow moments.
The intellisense story is very poor compare to C# or VB.Net,
but C++ is a hard language to parse, so I’m not (too) bothered by the
issue. A C++ programmer is supposed to built his own API anyway, so it
doesn’t matter J.
What really impressed me was the debugging story. I
had the data tips for native C++ types like vector<wstring> (!!). As
far as debugging went, it felt nearly as good as the managed world.
One thing that I miss is the exception assistant for std::exception
(or just a way to get the exception message), but I can live without it. Hell,
even mutli threaded debugging wasn’t that big of a deal (for a simple
scenario).
Really nice.
I implemented my own ref counting scheme and RAII for thread
safety, and didn’t swear much at all :-D. If this continue, I may start
going on tours through <algorithms>.
As an aside, the intellisense is familiar with Guard and
MutexGuard, but I can’t find them mentioned in the help anywhere,
and it causes compiler error when I tried to use it.
Mircea Jivoin has back-ported my NHibernate
XML Column to .Net 1.1 and VS 2003.
It is attached to this mail.
Thanks Mircea…
Download: XmlDataType2003.zip
I am trying to play Black & White 2, and I'm running into a lot of issues with my graphic card (ABIT R9600XT) the default drivers crash often when playing the game, and trying to update the drivers resulted in crashing the computer itself when playing. This is a fairly old card, and it is only capable of displaying B&W in the lowest level of detials, but I am still blown away by the game.
My requirements are:
- Stable Drivers - I'm not a top notch gamer. I want stable drivers.
- Dual head support - not something that I'm willing to give up ever.
- Support the things that B&W 2 needs.
- Not a big, noisy monsster.
Any recommendations?
For the past week I have been doing quite a bit of work in unmanaged C++. It is mainly a set of small utilities that we need, and they can't have a dependency on anything.
I used to be a big bigot for C++. I understood RAII and shared_ptr, I could read templated code without a hitch and I occationaly even managed to write a program where pointer chasing was optional :-)
Now that I am working in C++ again, I am amazed to find out just how much I forgot, and just how much stuff is just not there.It was so bad that I actually had to do a search for "Hello World C++" just to find the correct syntax to get the application to compile.
I spent a several minutes searching for std::string.split() method. I knew that it had one, but I could find it (never mind the intelli sense story for C++). I slowly dawned on me that I was actually thinking about System::String, and that C++ really does have more than a single string type.
I still remember the high level concepts, but I lost a lot of the instincts that I had for C++.
For instnace, should a method have a return value of std::string, or std::string* ? What is the meaning of each? I had to actually consider the implications of those decisions before I could go on. And don't get me started about having to worry about releasing memory. I need to write some mutli threaded safe code in C++, and just making sure that all the threads are releasing memory appropriately is going to be a huge headache.
But even beyond that, there is the not small issue of needing to remember all the API that I need. It is not just shared_ptr vs auto_ptr, it is simple things like reading a file or consuming XML.
I feel so lonely without the BCL...