Posts

Showing posts from 2010

DSL & ANTLR

Martin Fawler in his good "Domain Specific Languages" book  heavily uses  ANTLR  to describe topics related to external DSLs. So, I pick the thing up and got to use it. It can generate lexers and parsers in C# (as well as in some other languages - java, c, c++, python). ANTLRWorks is a IDE with syntax highlighting, grammars visualization and even graphic debugger! What's rather strange and annoying that the latest ANTLR (3.2) and ANTLRWorks (1.4.2) generate wrong C# code - some attribute classes are just not defined in any assemblies. However, as ANTLRWorks 1.4 (with ANTLR 3.2 integrated) generates proper sources, I quite happy with the tool :) I recommend the DSL book and ANTLR to every senior developer who needs introduce a DSL into his project instead of tedious XML files or handwritten parsers.

GOOS paper book is here!

Yesterday the GOOS paper book was brought by FedEx! Although I've read the e-book three times, I felt necessity to say 'thanks' for the authors by buying a paper copy. Then, thanks Nat and Steve!

Think twice before make big refactoring to code is new to you

"...[existing code] rewrites should be avoided because the programmers will not have been able to understand from the code why the software does what it does and, when rewriting, will revisit all the same mistakes the original programmers made. The same can be said [...] about making big refactorings to code that is new to you when you are not adding any new functionality to the system. It's only by adding a new feature that you can get a feel for the structure that the code needs to have. Otherwise you're just noodling about aimlessly and your refactoring will very probably make it harder to add new features in the future." Nat Pryce

GOOS. Again :)

A couple of days ago I've started reading the excellent book I've ever read - GOOS . For the 3rd time :) And I find it even more useful than earlier.

DDT is an awful thing

The book from my previous post turned out to be a one about POSIX process which in short is old big-up-front design mythology with huge class- and unreadable sequence diagrams, reverse engineering and all the dirty stuff I was absolutely sure died some years ago... Reading the book was a waste of time (especially by the Red See).

DDT

Just started reading  Design Driven Testing: Test Smarter, Not Harder  by Matt Stephens, Doug Rosenberg. The authors declare that DDT is better than TDD. I'm looking forward to get whether it's true :) Anyway, it seems as a wonderful reading in Egypt :) 

Holub is given up

I gave up reading the Holub's book two days ago since it became very boring as the author started unfolding the endless examples :( So, it's time to find another one :)

Holub on Patterns

Recently I started reading "Holub on Patterns: Learning Design Patterns by Looking at Code"  by Allen Holub and I find it very interesting so far. The author's view on OO design is quite fresh and even extraordinary in places. Although his criticism of accessors and class inheritance may look extreme at first, it's become clearer and clearer to me that the author is absolutely right in his ideas. Looking forward to continue the reading!

Steve Freeman about class naming

"...but to me XXX, XXXImpl (or, worse, IXXX, XXX), is a missed opportunity. I want my class name to tell me /something/ about the implementation so I don't have to look in the code: even if it's just that the implementation is backed by a hash set." - Steve Freeman .

Breaking dependencies in unit tests

"Would I use classloader magic and bytecode manipulation to set dependencies in production code? No. Would I use reflection to modify private fields in production code? No. Would I refactor to introduce an interface between objects? Yes. Would I refactor an object to get a dependency through its constructor instead of from a global variable? Yes." Nat Pryce

End-to-end tests and a horse in vacuum

There's a subsystem (a console app that receives tasks and sends reports via WCF). About a month ago I, influenced by GOOS book, wrote a couple of end-to-end tests for the app just before making another refactoring (yes, the app is rather messy) and adding a new feature to it. I liked how it worked. Yesterday I did a quite big refactoring of the subsystem doing TDD. Things went really smoothly and a bunch of small, focused, loosely coupled classes were the result. At the end, when I was sure that everything is ready to launch the app, I run the end-to-end tests and (uppps) one of them was red! Good! It turned out that I added a class implementing a role interface that'd been already implemented by another one and pass the former as a dependency. The class has default fake implementation (it threw a NotEmplementedException) and cause the app to shut down in a rather rare case (which luckily was covered by the test). What I realized from this story: we must write end-to-end tes

IWanderAboutInterfaceNames :)

"A colleague was once accused of being so role-happy, that he defined an Integer as a combination of Addable, Subtractable, Multipliable, and Divideable.", Steve Freeman's blog

"Growing Object-Oriented Software Guided by Tests" book

"Growing Object-Oriented Software Guided by Tests" by Steve Freeman and Nat Pryce is the most useful, serious and well-written book I've read in last couple of years. It's all about TDD (test-driven development) and OOD. The book shows how unit tests evolve good OO design and how end-to-end tests let the programmer be sure that the hole system actually works. The book is not for juniors - to get the ideas work for you, you must have many years of experience as a software developer, not an architect, a project manager, a coder or whatever. Every programmer writing in any OO programmer language must read the book twice. I've done. Among others, I like the authors' conception of "test data builders" which extremely simplifies creating value type objects in tests. There's an open source library for create the builders easier - "Mare It Easy" (its .NET port is available here ). I've just tried the latter one and I realized I'll fal

C# regions

I really HATE regions in C# code. What they actually do is only hide the whole blocks of code. You don't see the entire class when you open it in the editor. What you get is the class's name and a bunch of silly blocks which you must click one after another in order to see what they hide... Even after that the code is messed with the f...ing #region ... #endregion there and here. What's the point in collapsing a class into +fields, +constructors, +properties and +methods blocks?! However, there's a worse thing to do - "regioning" pieces of a single method (yes, I've seen such a horrible things twice or three times in my career). Just imagine a double nested switch 2000 lines of code length. Done? Well. Now surround each of "case" with "region". I've seen it in reality :( My opinion is simple: regions cause worse code in general - big classes with tons of big methods.

Legacy code and vodka

Reading the excellent "The Art of Unit Testing" book by Roy Osherove, I found a brilliant thought: "Finally, as a friend once said, a good bottle of vodka never hurts when dealing with legacy code." :)

SVN

Just after I set up and got to work a local SVN repository thinking how the thing is really sloooooow, I came across a brilliant sentence in the Uncle Bob blog: " ... there’s all the fiddling around with time accounting tools, and horrific source code control systems that perform like a salamander crawling through frozen mud" . Excellent!

Blood pressure :)

My wife and I have just measured our blood pressure. What's really strange that she and me have exactly same value - 118 by 74! I don't really know what it could mean...

Summer is in Moscow

It's been so hot for last week here in Moscow that I started to remember the Russian South :( I hate heat since I was a baby. However, it was amazing to cycle 60 kilometers in +38C several years ago... The face was partially white with salt :)

Spring 2010 is coming

The first blossomed tree has been seen in Moscow today! :) Spring is coming...

The new PC

Buying a new PC belongs to the most exciting things in the World :) It's so beautiful, fast and cool...

WF 4 is coming

I feel really wise myself :) Don't wanna ask me why? So, I've been delaying learning .NET Workflow Foundation so much time. It's been very wisely, as the forth version of the library has been completely rewritten by the Microsoft and it's not compatible with the 3.x one. The designer works in WPF (smoooothly), the architecture is elegant and (the last, but not least) the library in general is 10 to 100 times faster than the previous version. So, I've started think where this new wonderful WF could be fit in my current project.

MS Azure

I'm quite amazed after reading "Microsoft Azure in Action" book (Manning MEAP program) two weeks ago. It's a really promising technology with, no doubt, big future. It's a pity it's not yet available in Russia (the country isn't even planned...)

SSIS Checkpoints

Image
The Checkpoints + Raw File Staging in SSIS 2008 is an absolutely wonderful thing!

SSIS!

The real winter in Moscow

What I really love in living in Moscow - the real winter! It's been snowing and frozen as it should be in winter for four years. The weather is so much different to the one I used to survive in Krasnodar region since my childhood, that I can't believe my eyes and my frozen foots! ;) Wow!