Posts Tagged ‘Computers’

On Patterns…

Thursday, November 20th, 2008

I’ve recently stumbled across this post (which, by the way, I highly recommend its reading), which has someway enticed me to add some comments. Now, this doesn’t mean I don’t agree with the author concerning a few arguments; I just want to raise the awareness over some points I find particularly important. 

Linda Rising, in the last PLoP conference, said something along these lines: “A pattern shouldn’t be an Ahah! or Eureka! but something more like an Hmmmm!”. 

The thing is, a pattern is something recurrently seen in the wild, that try to give an answer to a problem by balancing the forces in some particular way. Not an intelligently crafted solution in the author’s basement. A good pattern is one where a domain expert is able to easily recognize the pattern as: “I’ve seen this!”.

Now, if the GOF’s Design Patterns should have been more or less abstract than they are is ultimately irrelevant; the authors observed those patterns in a particular context, and while they may hold outside that context, that can’t be neither guaranteed nor intended by the authors. That’s why patterns typically have a target audience. In the context they wrote the book, putting additional effort into implementation details have probably lead far more people to grasp it, than it would have been otherwise.

Furthermore, as an example, Ralph Johnson, during the last PLoP workshop, suggested that the patterns I wrote could be generalized far beyond Adaptive Object-Models and into a broader OO perspective. However, that would need a completely different context-problem-forces triplet. Now, someone reading my paper could say: you focus too much on AOMs; you should have generalized. Well, it’s true. But the proposed pattern is intertwined in a specific pattern language, which has it’s own context and forces. For that purpose, I may actually have given too little detail, since several comments I received asked for more in that direction!

Alexander’s work is a great example of what I’m trying to say. The Notes on the Synthesis of Form could, and are easily abstracted into several realms far beyond Architecture. Should we state that Alexander coupled himself into unnecessary detail?

I believe the problem may not be in the patterns per-se (nor even in the GoF book, which should be regarded as a germinal work), but in the people using them. Personally, I think too few people know the GoF book, or for that matter, patterns in general. Those who know and apply them blindly, have completely missed the fact that a pattern is NOT a building block! Maybe that’s why GoF entitled their book as Elements of Reusable Object-Oriented Software, and not Design Rules of Good Object Oriented Software.

Richard Feynman once said: “Know how to solve every problem that has been solved.” I believe the study of patterns endure this ideal. They are not engraved laws of the tissue of software. They are a systematization of intrinsic, almost empirical, observed knowledge.

Quote of the Day

Saturday, November 15th, 2008

(…) there are two ways of constructing a software design. One way is to make it so simple there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.

 – Tony Hoare [Turing Award Lecture, 1980]

Innovation stiffs old practices…

Sunday, October 12th, 2008

While reading a post about the new language Microsoft is supposed to release in their next development platform, I’ve found an alarming message in the author’s blog:

“But if all newbie programmers learn these new languages, who will manage the billions of lines of C and C++ we currently use in the future, unless it is implied to be completely be rewritten?”

I’ve heard this line of rationale before… Who will manage the billions of lines of assembly now that people use C and C++? Who will program hardware, now that Universities’ degrees only focus on high-level software?

Careful: this kind of thought is presumptuous at best. Don’t get me wrong, this is not a direct critic to the author, but to the concept. Practices and tools *need* to evolve, so we can achieve higher degrees of abstraction. Attempting otherwise only hold back evolution (and may turn us into old-school dinosaurs, who keep mumbling “back in those days, we used two big drums to program; one was called 1, the other 0″).

After all, there will always be people wanting to beat those drums… :)

Good old-skool h4×0r!

Monday, September 29th, 2008

As seen on slashdot, this story made me smile in pure, raw nostalgia:

The manual for Mental Blocks claims that, for both C64 and IBM, you put the diskette in label-side up.  I thought that had to be a typo, since every single mixed C64/IBM or Apple/IBM diskette I have ever seen is a “flippy” disk where one side is IBM and the other side is C64 or Apple — until I looked at the FAT12 for the disk and saw that tons of sectors in an interleaved pattern were marked as BAD — very strange usage.

Absolutely… beautiful!

PLoP paper accepted

Tuesday, September 16th, 2008

A paper I submitted this year to PLoP, “Patterns for Data and Metadata Evolution in Adaptive Object Models”, co-authored with Filipe Correia and Leon Welicki, has been accepted for publication. I’ll be attending both PLoP and OOPSLA this year in Nashville, Tennessee, USA. Meet you guys there :-)

Internet may become sentient?

Tuesday, September 16th, 2008

Another option is the idea of the net itself becoming sentient, a vast self-modifying array of connections and information storage with limited connections to the outside world (kind of like that glob of grey goo you carry around in your skull).  If that happens then Gibson help us all - remember that the net is made of about 90% spam, 9% porn, and quite a lot of whining blogs.  If that mixture ever becomes self-aware we’re not quite sure what it’ll do, but the odds are against it being anything good.

Simply Hilarious! You can find the full article here.

All Your Pointers Are Belong to Us

Wednesday, September 10th, 2008

At the sound of I’m a Believer - Smash Mouth:

I thought memory leaks were only true in unmanaged code.
Meant for someone else but not for me.
Leaks were out to get me,
That’s the way it seems,
There are pointers haunting all my DIMs.

And then I saw Dispose(),
I’m a believer.
Not a trace,
Of leaks in my memory.
I saw Dispose(),
I’m a believer, 
I couldn’t leave it, 
If I tryed{} catch{}.

I thought GC was more or less a given thing,
The more I new’ed the less I got, Oh Yeah,
What’s the use of collecting,
All you get is lag,
Being OutOfMemory() is too bad.

And then I saw Dispose(),
I’m a believer.
Not a trace,
Of leaks in my memory.
I saw Dispose(),
I’m a believer, 
I couldn’t leave it, 
If I tryed{} catch{}.

Lyrics by me and Hugo Silva ;-) Ready yourself for an MP3…

.NET Memory Leak and no solution from Microsoft…

Sunday, September 7th, 2008

You think that living in a managed world eliminates your worries with memory leaks? You think that as long as you don’t touch unmanaged resources you’re safe? Well, think again…

I’ve recently been struggling with .net because of Panels not being destroyed. Since I dynamically create these panels, which hook upon several events in the system, the application started to crawl down after a while due to some thousands/millions of events being fired to panels that should no longer exist. When we started testing the code line-by-line, what we’ve found amazed us: a particular Panel couldn’t be destroyed due to having AllowDrop set to True. WTF?

But there it was: set it to false, and the garbage collector happily destroys the object. Set it to true, and Dispose() is never called, the Panel lives, and the application stalls.

We thought: a bug in .NET? Does this happens in 3.x as well? Yes, it does. But, how is it possible? No one ever found it? After all, Drag’N'Drop is a common feature. Well, apparently, one guy did. But, either I’m misunderstanding the solution, or there is no solution at all.

Help?

Cocoa Programming

Monday, August 25th, 2008

I’m currently reading Cocoa Programming for Mac OS X. I’m becoming astonished by the underlying technology in Cocoa. There are some drawbacks, it’s true: for instance, Objective-C is much less intuitive than Java or C#, the whole .h files seem pretty much deprecated nowadays, and there’s definitely a learning curve there. But having a book like this can help a lot in the process.

I’ve just finished chapter 11 from 35 in total. I must say that by now, CoreData amazed me by allowing to create an application to display, manage and persist (with an Undo/Redo mechanism and all) a simple Information System to catalog Books (along-side with an Image, rating, etc…) without a single line of code. What amazes me most, is that there’s barely code-generation going under the hood: it’s the whole pervasive MVC architecture in Cocoa that allows you to bind hotspots everywhere.

I strongly advise every programmer who can to read this book and do the exercises up to the eleventh chapter. If after this point you aren’t convinced, you can flame me at will :)

My whole dilemma now is: I’m a developer for Windows (it sucks, but that’s what the company I work for do). I can see the potential in this framework, business-wise, but I can’t seem to find a way to bring this into the Windows world. Any ideas out there?

Logic gates with Dominos!

Monday, July 21st, 2008

Pre-Thesis and Current Research

Tuesday, July 15th, 2008

I’ve presented my PhD pre-thesis on the past 2 of July, and I’m glad it has been accepted by the Jury: “Adaptive Object-Modeling: Patterns, Tools and Applications”. I was also honored to have Joseph Yoder, from Refactory Inc., as my external supervisor. His contribution and ideas will be, undoubtedly, extremely useful during my doctoral research. I’m now officially a PhD. ABD (All But Dissertation).

For those who are wondering, the Adaptive Object-Model (AOM) is a software architectural style which allows for runtime adaptivity of the domain model. It succinctly consists on using an object-based metamodel as a first-class artifact from where all concerns are inferred, or derived from; classes, attributes, relations and behavior are represented and stored as data. At runtime this information is interpreted, instructing the system which behavior to take. Changing the model data immediately results on the system following a different business domain model.

The fact is, while an AOM defines a software architecture and design, any particular implementation of an AOM results in a Domain Specific Language (DSL). There are no standard DSLs for AOMs, and probably there will never be; the strength of AOMs rely in the fact that they are built bottom-up, instead of the top-down approaches other MDSE (Model Driven Software Engineering) methodologies and tools are based upon.

Actually, my thesis will be exactly about that: the study and documentation of a set of patterns, recipes and tools, together forming the basis which any developer can pick and use in its system. The validation of the thesis will, in part, be evaluated by the construction of a prototype framework that lies upon the theoretical models inferred (which, incidentally, is progressing fast enough to already have some production-level commercial applications built on top of it!)

For those who are not following along, let me put things this way: imagine you pick up any semi-formal notation, like UML + OCL, and you feed it to a program. This program will adapt itself, from structure to interface, resulting in a new application ready to use, without any further programming from the developer. You feed it the model that represents an Archeological Heritage Information System, and done! But there’s more: while the system is running, you change the model: you create new objects, new business rules… All applications will react according to the new model, and will evolve automatically, while maintaining their integrity, without any kind of code-generation or shut-down.

Do this seem like a dream? Well, it isn’t. It’s reality, right here, right now. But, somehow these theories never became mainstream. I intend to change that… or at least, give a small contribution :-) And this is my thesis on a nutshell (details are always boring).

While writing this post, I also received an email from a friend suggesting that I should read Martin Fowler’s latest blog posts. It’s interesting that DSLs and MDSE is gaining so much attention these days. Martin, we are all anxious to lay our hands in that new book of yours ;-)

Writing Papers…

Wednesday, May 14th, 2008

As I finish my paper for submission tomorrow (PLoP’08), the following strips start to give me that sense of deja-vu:

I guess one day I will laugh out loud about this… but not today :-)

First annoyance in Leopard

Saturday, April 5th, 2008

Since the very first usage, I’ve found safari very slow when starting a page display, but I blamed the rendering engine for that. However, slightly after installing Little Snitch, I’ve incidentally realized that something wrong was happening with the DNS: it was taking too long to answer. By digging some pages on the internet, one can conclude that by adding the OpenDNS server addresses to the DNS section on Network preferences, the problem is fixed.For more information, check this forum.

… do architects suffer like us?

Monday, March 31st, 2008

Stakeholder's View on Software Construction

I’m becoming addicted to making these…

… must… resist…

Monday, March 31st, 2008

Dating Rules for Computer Scientists

Computer Science

Monday, March 31st, 2008

Computer Science

Yes, insomnia sucks…

My Thesis in a Nutshell

Sunday, March 30th, 2008

AOMs.Equals(42)

Singleton using Generics

Friday, March 28th, 2008

Here goes a tip from my colleague José Vilaça for “elegantly” creating Singletons using Generics in C#2.0+ :

public sealed class Singleton<T> where T: class, new() {
 private static T _instance;
 private Singleton() { }
 public static T Instance {
  get {
   if (null == _instance)
    System.Threading.Interlocked.CompareExchange(ref _instance, new T(), null);
   return _instance;
  }
 }
}

Here’s an example:

Console.Writeline(Singleton<object>.Instance == Singleton<object>.Instance);

Of course, T must be a class with a public constructor without any arguments.

Acid3

Friday, March 28th, 2008

It seems that two browsers are now passing with a 100/100 score in the Acid3 test, namely:

Both Firefox 3 (beta 3 gives 61/100) and IE 8 (17/100) seem to be lagging behind each day it passes.

7 days and counting…

Wednesday, March 26th, 2008

So, I decided to buy a Macbook Pro and migrate once and for all to Mac OSX. I decided to go with the base specifications of 2.4Ghz Penryn w/ 2Gb RAM, 200GB Harddisk and a GeForce 8600M GT 256GDDR3. Nevertheless, I chose the Glossy screen and also bought the Apple Remote.

I intend to make an upgrade to 4Gb latter next month (Kingston 2Gb Memories are now priced at 42€), and get a 1/2Tb external harddrive for Time Machine.

28 Mar: Shipped From Originating Depot at Shanghai.