Friday, March 30, 2007

Life is a Wicked Problem

Yesterday I was reading about studying online (in the OpenUniversity), I was gladly surprised to see that some of their courses are now available on line for free, and, that you can even remix the content using a free software for mind maps built bye the Compendium Institute, the funny thing is that I ended up finding information wicked problems (and currently I have one, choosing the java frameworks we will use at my current job)... wicked problems are those that (from Wikipedia):
  1. There is no definitive formulation of a wicked problem
  2. Wicked problems have no stopping rule
  3. Solutions to wicked problems are not true-or-false, but good-or-bad
  4. There is no immediate and no ultimate test of a solution to a wicked problem
  5. Every solution to a wicked problem is a "one-shot operation"; because there is no opportunity to learn by trial-and-error, every attempt counts significantly
  6. Wicked problems do not have an enumerable (or an exhaustively describable) set of potential solutions, nor is there a well-described set of permissible operations that may be incorporated into the plan
  7. Every wicked problem is essentially unique
  8. Every wicked problem can be considered to be a symptom of another problem
  9. The existence of a discrepancy representing a wicked problem can be explained in numerous ways. The choice of explanation determines the nature of the problem's resolution
  10. The planner has no right to be wrong (Planners are liable for the consequences of the actions they generate)
And it turns out that:
  • Software development is a wicked problem (and that is my job)
  • Life is a wicked problem (and... well, I am alive)
One thing I specially liked was a document explaining in a very detailed how wicked problems happen (read it here), and it turns out that a really good way to explain it is with a graphic, like this one.

Now.. that image can be produced, by thinking that each person participating on the solving of a wicked problem has his own "pendulum" and moves from "solution thinking" to "problem thinking" on his own, not synchronized way... if find this funny... because a few days ago I was seeing Kent Beck's presentation "Ease at Work", where he describes how a lot of software developers feel (one day we are super wizards... the next we are crap.... the next we are wizards again), but we are not hired and fired in perfect sync with how we feel (sometimes we are even treated as wizards while inside we feel like losers and vice versa), and in his presentation Kent Beck says that software development is not only about programmers, that is about people, people interacting to get a problem solved (you can't have a software business without software developers, but you also can't have it without managers, even if it just a "change of hat"), so, this got me thinking... that the problem Kent Beck is describing, is precisely, a Wicked Problem. What do you think?

Friday, February 23, 2007

OO Principles

Hi! Today I am reading the book Head First Object-Oriented Analysis and Design, I specially liked the OO Principles, I have already read about them in c2, but I really like the way they are summarized in this book:
  • OCP: Classes should be open for extension, but closed for modification. (to avoid new requirements breaking old tested code)
  • DRY: Don't repeat yourself, avoid duplicate code by abstracting out things that are common and placing them in a single location. (to avoid having to fix the same thing in different places, or solving the same problema again, and again and again... I believe this is releated to YAGNI balances OAOO.... i guess I could say that YAGNI balances DRY, and therefore DRY equals OAOO)
  • SRP: Single responsability principle, every object in your system should hava a single responsibility, and all the object's services shoul be focused on carry in out that single responsability. (to avoid Big Ball of Mud, a huge object that does everything, that is hard to extend, hart to understand, and lots of stupid little object that do nothing, mmmm, this reminds me of a pricinciple I read about a long time ago about balancing the intelligence between your objects)
  • LSP: Subclasses should be suitable for their base clases (to avoid confusing code, on which you believe you can use a member of class hierarchy, and after trying you realize thet the result is not the expected one)

Thursday, February 22, 2007

OpenLaszlo & Spring & Hibernate

Hi!
Okey, changed my job again, time to rest from .NET and to refresh my Java abilities... my goal for this week is to find an easy way to teach everyone at my new job how to build a great application using: Hibernate + Spring + OpenLazlo...
My Java abilities are a little rusty so this is going to be a really entertaining challenge..

Here are some links I have found about this:

Seems that finding information on Laszlo is harder than I thought...

Friday, January 12, 2007

When will that feature in your system will be finished?

That seems like a very simple question: "When will feature "X" be finished?", specially if do not have a lot of experience being the manager of a software development team... but the problem... is that the task of developing a feature has, as many things in software development different faces... its one more example of The Blind Men and the Elephant.

In this case.. when is the feature "finished"?:

  • After the Developer says it is finished?
  • After the Architect says the code is maintainable and extensible?
  • After the Tester says that the feature is bug free?
  • After the User says that the feature meets his expectations?
  • All of the above?
  • None of the above? Then... when: ?

It is easy to see that I believe it is not a question easy to answer... why do believe that?

Well in my opinion the main difficulty to answer it is that that software development is not a linear activity, with a beginning and an end, but an iterative activity, if the Architect doesn't believe the the code is maintainable and extensible, then the code will have to be modified (either by him or by the Developer) and after that, if the Tester finds bugs, the code will have to be modified again to fix the bugs... but those modifications might introduce more bugs to the code, so the code will have to be tested again... its a cyclical process, it has to be done many times before reaching the end, in other words, it is not an "if" answer, but a "while not" answer.

Therefore: effort in trying to reach the end can be registered... but it is impossible to tell how far from the end we are... maybe one, maybe ten, maybe a hundred iterations away.

Friday, January 05, 2007

Is Linq really such a good idea? Are SQL Strings inside C# really such a bad idea?

Today, a friend at work asked me a question "how to sort in a stored procedure?" Of course there is a simple answer:

CREATE PROCEDURE [dbo].[Sorter]()

AS

SELECT * FROM Table ORDER BY Field

 

But... what if you want to order by any field of the table? That is a "dynamic order by"... well then:

CREATE PROCEDURE [dbo].[Sorter](@SortOrder tinyint = NULL

AS

SELECT Field1, Field2, Field3 FROM Customers ORDER BY CASE WHEN @SortOrder = 1 THEN Field1 WHEN @SortOrder = 2 THEN Field2 ELSE Field3 END

Great!... well not that much, because it only works as expected if all 3 fields are of the same type (of course we could convert them all to string... I mean "nchar")

My friend has all this problems because he is trying to avoid the dynamic slq approach (either creating his own dynamic sql generator, or using any of the available ORMs)

But this post is about LINQ... with LINQ, we will have relational extensions right there inside C#... that means no more language mixing (SQL inside strings inside C#)... but that also means... no more dynamic manipulation of SQL (AFAIK C# can not manipulate C# as a string, they way it does with SQL)... So... will LINQ really simplify development of data manipulation applications? or will it complicate it more by preventing us from easly and dinamically manipulate queries ? or is this just an SQL limitation (maybe SQL should allow as to have parametrized sorting?)?

I guess I'll have to do more research...

Wednesday, January 03, 2007

Handling Relative & Absolute URLs with System.Web.VirtualPathUtility

Until today, I translated between relative & absolute paths in ASP.NET "by hand". Example:

 

private string ToAbsolute(string url)
{
if (url.StartsWith("~"))

return (HttpContext.Current.Request.ApplicationPath +
url.Substring(1)).Replace("//", "/");
return url;
}

 

But now, it turns out the with ASP.NET 2.0... I can achieve this effect... by simply calling VirtualPathUtility:

 

VirtualPathUtility.ToAbsolute(url)

 

Much simpler... don't you think?

Requirements Analysis: Negative Space

A while ago, I was part of a team working on a crucial project. We were confident, relying heavily on our detailed plans and clear-cut requi...