What is going on under my hat

WordPress error: too many redirects

WordPress error: too many redirects.

A friend noticed a problem with my site, and that link has the solution to it. Basically you install a plugin and it is done. I am not sure when the trouble started, but my guess is that the last update from WordPress fired it.

The interesting thing is that I didn’t notice because I always acces the administration page, not the site on itself. Funny.

3 Weeks to live, live!

I was following the guys in 3 weeks to live, and when they stopped posting details a few days ago I thought ‘well, sometimes it works, sometimes doesn’t’.

But early this morning (or late past night) , while doing my own code, the news reader jumped. They did it, OnCompare is live now, and it looks pretty good. And the results provided by the site are good as well. I really like it.

On the other side, I feel very envious. I did my own share of crazy projects, and in fairness since I saw them I started harassing my friends to do the same, but right now, I feel very very envious! :D

Congratulations, it is a brilliant project!

Interesting links from 2011-01-22 (Kanban)

Atlasian Bitbbucket: a free and private Mercurial repository for small teams

I was looking at open source / free applications to do Agile with a Kanban flavor, here are the places I found:

FDD Project management application

Express – Agile project management

Agilefant

Agilo – Flexible software for project management (Python download)

Digaboard – Task board gone digital (PHP and mySQL download)

Radtrack – Agility with cards (free service)

Apropos – Agile Product Portfolio Scheduler (launch in May)

SeeNowDo – Digital dashboard for distributed agile teams (free service)

SimpleKanban – A Kanban board in simply one HTML file

Scrum Agile Software Project Management Open Source Tools Directory

And I went around other things as well:

Collaborative fund

Drive: the surprising truth about what motivate us (video)

Top ten reasons to run your own business (Inc magazine article)

PeopleRank: Quora Is Developing An Algorithm To Determine And Rank User Quality (Techcrunh)

A Modest Proposal for America: Build 500 Accelerators (Launch)

Backlit photography samples

Cloud9 Javascript IDE

The truth about real estate (Inc magazine article from the guys in 37 Signals)

National Geographic Magazine: 50 Years of Covers

Entrepreneurship survey in Ireland

And some notes about DDDD:

The generic repository

Repository is the new Singleton

Long live repository

More on repository

Hexagonal architecture (notes from a chat in a book club)

Learn REST: a tutorial (fast, easy and educating)

The Pragmatic Programmers magazine (free PDF download)

Exiting the zone of pain: static analysis with NDepend

The reactive extensions (LINQ libraries for push operations)

Interesting links from 2011-01-21

Put a Flex UI On Your Application

CQRS Starting page

Uniqueness validation in CQRS architecture

Layered architecture (going towards Hexagonal)

Inversion of control patterns for the .NET Framework

Steve Fenton – Javascript

Container tutorials

Dynamic DNS providers: DynDNS – Pricing

Dynamic DNS providers: DNSMadeEasy – Pricing

The World of Notch – blog from the programmer behind Minecraft

The Hexagonal Architecture and the pot of gold

As part of my research, I was trying to see how the big traffic sites are implemented. A lot of things are going around, a few diagrams are popular, but the main point seems to be able to distribute your code in as many machines as practical, as cheaply as possible.

That is good and reasonable, but in the end, my question was still ‘how do you do your code?’. Going specifically to it, the spectrum is broader, and you can find from massive spaghetti code, to massive structures done under industrial ideas and everything in between.

From all those approaches I liked most the DDDD approach, it being a distributed domain driven design. I knew DDD already, and the distribution part just made sense.

There are again a few different approaches to it, but being in .NET NServiceBus is the one I choose to follow, so I spent some time around it, and again, it makes sense when you look at the problems it is trying to solve.

But even than it makes sense, something was missing in the picture, at least the picture from the web site and mailing list. It looks more than a bunch of libraries (with very good reasons behind), but still suspiciously close to ‘use this technology and everything will be great’. I know that each one making that statement probably mean it, but I heard it too many times to believe in ‘technology’ solutions.

And then, I found CQRS, and from some video got the magical words ‘hexagonal architecture‘. It is a pattern, and as usual with them is deceptively simple. Instead of being concerned about a long line of code blocks calling one to the other, make it a single, tightly coupled core dealing with the outside using adapters. In particular, take the data layer outside of your model, and make it an external service.

I just loved the idea even before reaching the end of the article, but found it difficult to explain it to others. ‘What is the new thing about it, compared with any other data access layer?’, I was asked, and heard me babbling as I usually do when too many ideas jump in my head, obvious for me and nobody else around.

Now, the important thing for me is (and I just realized it a couple of hours ago) that instead of the situation from the last ten years with an object model and a relational model living in the same chunk of code (being it a single library or an arbitrary number of them but all related and interdependent), you can have only one model on each application. One for the domain, one for data storage, one for the external API, one for UI, one for Santa Claus if required. That is brilliant!

Do you have a business operation that you want to model? Do it disregarding anything about data storage or user interfaces. Make your model, make it the best you can, as simple or complicated as you need, and then request services from others (the main suspect the database) and provide services for something else (a UI or an external consumer).

The magic is, in your domain model now you really, but really really, don’t care about relational data. It does not matter if you have SQL or not, if you use an ORM or directly call ODBC. Data providing will have its own application, and the model in it will be only relational (or whatever you want). No business logic there, you don’t care in data storage about validating, or cascading activities, or logging or anything else. Your data storage application will only be concerned about storing and retrieving data. Just data. Genius!

There is nothing new in there. That should have been the role of the data layer. but the thing is, I never saw it so clearly separated until now. The theory was right, the implementation always ended as a mess and a bigger or smaller monolithic application.

The philosophy is even older, I still remember talking with people in FidoNet about the theory of Unix, and being thinking ‘what is a theory of an operating system? It is just a big program!’ without realizing that probably a very important concept was the fact that each operation is auto contained. You have twenty small applications and you pipe the results from one to the other. There is no need to solve the big problem (taking months or years of development), just do an application as small as possible, involving one activity to model, and off you go. It is a different implementation, but the concept is the same, and I love it.

How do this translate to my daily practice? Well, now I can focus in one thing at a time. I can do the model for something I need, finish it, and forget it. Then I can do the data storage. Or the UI, or some other atomic model. I can keep the external references outside, and prepare a bit of code to emulate the real thing until I have time to do it properly. Basically, I can advance a step at a time, and not be concerned about a landslide sending me back to the starting point. And I even get an extra bonus, because now application distribution is trivial, everything is distributed from the start!

NB: I am talking again to you, monkeys, it looks like we stroke gold here. Instead of being concerned about how long we will need to work until having something useful, we can make it as small as needed to be done in the available time, and still get something of value. Solid, commercial value, not just learning something new or doing something interesting. Are we going to stay sleeping or can we take the opportunity to eat an elephant a bit at a time? It is soft, it is golden, can we check if it is real gold with code?

New laptop, twice the fun

Apart from the cluster and the other dozen of computers at home, I got my last work horse in 2003, an Inspiron 5160 from Dell.

The thing was expensive, badly designed (it spent three months in service, one for each new motherboard it required until I clipped the insides of the case to stop it ripping the board apart) and lived miserably until a couple of years ago when I stopped using it. Before that I even tried to upgrade it a bit with more memory and a new hard disk, but finally the external wifi card failed and I didn’t bother getting a new one (a few Eee PCs replaced it, thank you very much).

But now the Colmenar is working, Visual Studio 2010 has a good number of nice features, and after a few months thinking I decided to get a new laptop. I got an HP ProBook 6550b, and I am liking it nearly as much as the Eee PC.

It came with Windows 7 64 bits, and a sledge of applications that I didn’t want, so after a few hours trying to remove them I wiped the disk and installed Ubuntu instead. The setup was fast and detected everything but the finger print scanner (which I don’t care).

After installing VirtualBox I went for Windows, and found that the disk that came with the machine had a 32 bits version instead of 64. I imagine that I could have called the guys in HP, but it is not a big deal (as other .NET people are doing, I wonder how longer will I stay in the lands of Uncle Bill) and the setup of Windows 7 32 bits in Virtual box worked without flaws. Visual Studio, SQL 2008 and the usual suspects went in without protests, and now I finally have a machine where I can run Python and mySQL on their natural neighborhood, as well as doing C# as fast as usual in Visual Studio.

The only point a bit annoying is that on the first boot, when Windows asked for my details, some of the dozen weird applications wrote the BIOS with a username and password related to the Mickey Mouse network I said I was using. After wiping everything, when I accessed the BIOS setup to change some details for virtualization, I found that those user details were used and now I can not change them. I didn’t spend too much time investigating, but I guess that I will be in trouble if I want to do a BIOS upgrade, but I think that it will not be another period of seven years until the next laptop. Hopefully, that upgrade will never be required.

All in all I am very happy with the ProBook, it is solid, good looking, the keyboard is surprisingly good for a laptop (I am writing this on it, even than the Natural Keyboard 4000 is my interface with the processor), and the screen is great.

Now, the only bit missing is to do some real programming :)

3 weeks to live

In the last few days I started following the progress of the guys in 3 weeks to live, a blog where a couple of engineers post a video recapping a working day in a project which has only three weeks to go live before everyone goes to other gigs.

Apart from the fact that I love the adventure (and feel very envious of them doing it, after so many times that I had good ideas and did nothing with them), they are sharing their experiences with tools and languages. One of them is AgileZen, and online project management styled as kanban, HipChat is another, and a few minutes ago I learnt that at least some of them are .NET programmers, but are using Rails just to learn while driving.

I hope they go well, and feeling more envious by the minute.

NB: you monkeys know who you are, when are we going to do anything at all? :)

Development speed

Just read two interesting articles about development in Facebook (How Facebook Ships Code and LAUNCH002: What I Learned from Zuckerberg’s Mistakes). Apparently the programmers choose what interest them, implement and deploy. A lot less ‘design, discuss, evaluate, prototype, etc.’ Just write the code and see how it goes. Even one week cycles!

Associated with that is a very alert operations team, checking for problems, and changes in user behavior (I wonder how they measure it).

I still remember that approach of ‘write the program and visit the customer’, but lost it many years ago. It is refreshing to see it again, and I wonder how long will it take to me to go back to that situation, given than I am more eager every day to write some code and make it fly. Could be anyone in Ireland working like that?

Clipper was BASIC for my brain

I believe it was Dijkstra who said something like ‘BASIC ruin a programmer for programming work’. I never agreed too much with that comment, probably because many programmers I know started with BASIC and then moved to something else without too much trouble (the rest who didn’t are not programming anymore), but I think Clipper had that bad effect on me, and in a much more insidious and lasting way.

My first data access was keeping everything in memory, feeding it from the program code itself. Some time later I started using tapes, cassettes, then floppy disks, and when I got a hard disk I end up programming a subset of SQL to simplify my increasing access to a random file in Turbo Pascal.

The thing worked well, and it might still be in use in a few shops in Argentina, but a couple of years later I moved to Clipper and its tables, basically because development time was half compared with doing it in Pascal, even when the results were dull and boring and I stopped wanting to show my programs and just wanted to get money from them. I stayed there for many years, damaging my brain cells with that mess until I forgot any real programming and saw everything as rows and columns.

When Delphi arrived I moved to Windows, but my soul was too tired to see anything else but tables, and the programming model had moved from Pascal as a multi purpose language to ‘go to Delphi to talk with Oracle‘, basically drop everything in a form and call a database. The possibility of doing something better was always there, but hidden, with just a few dry examples and everything corralling you to drop a data connector somewhere and link your form to the data. At some point they made a special form to contain all your queries and tables representation, and the best practice was to use stored procedures to be a good citizen, but in practice we were all making a huge mess of monolithic code.

When .NET arrived I thought there was some light at the end of the tunnel, but still it was a very long tunnel full of rows and columns. The N-Tier architecture was reasonable, and in theory you were able to get rid of tables in the UI, but in practice the same garbage was in place. Too many of us were brain damaged, and most of the enterprise projects I have seen since 2003 are in the end moving the rows and tables up and down the line, with a few translations in the middle to drug people to think that the data layer is isolating SQL from the rest. The fire test is to try to replace the database with something else (my phrase is ‘we don’t have SQL, we have a flat file, what are we going  to do?’).

During the last four years I was trying to become a programmer again, instead of a table administrator. I read the blue book, tried to do my repositories, and to keep SQL in bay, but in the end the properties kept me on the same league. It was too easy to say ‘change the Campaign.Status to “Sending”, store in SQL, dance a little and change again, now to “Sent”.’ In the end, it was all still Clipper code, but now with a number of fancy words going around, and more code to get people confused.

Now, there is nothing wrong with Clipper code, except when you see everything as Clipper. When someone says ‘Lets check the object model’ and fire up SQL Management Studio, from my point of view there is something definitively broken, unless we are talking about the relational model which is rarely the case, because even when Microsoft talks about objects in SQL Server, few people see tables as objects, they are just, well, tables. And the big deal is that SQL is just one application, with one idea behind (everything is in rows and columns), which works great for reporting, and less than great for everything else.

The final blow, requiring me to do a brainwash and forget about tables and rows is application distribution. In the end, SQL can live only in one server and that can grow only so much. At some point, no matter what magic configuration you apply, if your application has to deal with Internet volumes you will hit the ceiling, and if you used the N-Tier architecture with the database at the bottom permeating the whole application, you will have to answer my question of ‘we don have SQL anymore, what will we do?’, and rewrite a massive amount of code, or hack your app until everyone hates it and move to more interesting projects.

Remember, Fortran is not object oriented

I spend most of my time programming, making bigger and bigger pieces of software. I am in the same thread since 1983, when I learned Fortran during the summer break, and one thing that happens is that every time I review some code from a few years ago, I think ‘how in the world was I thinking this was a good idea?’.

My last pet peeve is about properties. They are part of C# (and Delphi before that), they are shown in every example, and I learned to use them everywhere. You create your class, fill it with properties, and off you go. If you are fancy, now you show them in a grid and congratulate yourself for not being using tables.

Well, you are on the same  old train. It is not a table, but you are still editing values in a row, calling it an object. Doing that in Fortran surely will be messy, but the end result will be no more unmaintainable than C#, and in a few years the only solution for anyone sane will be to rewrite, or torture a junior developer adding still more properties and keeping them in sync in forty disconnected places.

The problem is, now you need to know what is the meaning of the values in that property. Say you have one of those ‘InProcess’ rats in there. True means something is happening and the object should be left alone, false and you are free to do something else. But a few months later you find there are two different kinds of ‘InProcess’ status, and you can do Foo in one, an Bar on the other. Then you change the boolean with an integer, refactor the 80 lines that were using InProcess directly, fix the unit tests, if you have them, and declare the bug closed.

Wrong, the bug is still there, and now you have a few new guys doing different things based on that status, and changing it, and the junior dev will add a third value (hey, it is just an int, and the pattern to copy is there!), and two years later nobody know how that works, and a senior dev has to trace what the hell is going on, and make a document with a web of disconnected numbers, connected with lines. Great, time to rewrite! We will do it after we add this new value to the property ‘IsDeleted’, because now we want to delete things but keep them visible for the accountants :)

I was reading my own code from the last ten years and just hate it and want to burn it all, except that it is still producing money, and my goal for the next few months is to keep the number of properties in my classes to the minimum. Think three times before putting that innocent setter in there. Do I really need to change a value? An isolated value in a class, disregarding the context? If the context is not important, why is the property in the class then? OK, if the context add value, why the need to change an isolated property, forcing the next guy ‘to know’ what he is doing?

Can you express the idea better with a method? Are you sure it is more work to do that? Is it more work in the five minutes you need to write the method, disregarding the hours wasted later trying to know why the whole program is going bananas in a situation that happens only once every thousand calls? Funny thing now is that everything seems to get called a million times a day, but still finding a bug in a thousand is difficult, and you waste some hours, and your day is more miserable, and life would be better just rewriting all the code.