Statistics

Total Posts: 34
This Year: 0
This Month: 0
This Week: 0
Comments: 0


RSS 2.0

Recent Posts


On this page....

The Running Mate - Code available at Codeplex
Performance Talk at Swenug in Göteborg
The Running Mate – What is it and why?
The Running Mate - An Introduction
File based vs. wiki based documentation. part 2
File based vs. wiki based documentation. part 1
Complementary thoughts about software entropy and broken windows
Ubiquitous language == a common terminology
The curse of regions
Web 2.0 - an introduction of mine
Reagrding the Computer Sweden chronicle
DasBlog 2.0 and skin

Archives

 Full Archives By Category
 2007 Calendar View

Categories


Admin

Sign In

Acknowledgments

DasBlog Theme Design by: Tom Watts
E-mail: Send mail to the author(s)
Theme Image by: dreamLogic

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

 Friday, October 31, 2008

This blog post is part of a series of blog post that starts here.

Well, to be honest, it has been available all since this Monday before the Swenugpresentation. But I just added some missing files too so now it actually compiles too... Sorry about this if someone chose to download the code right after the presentation.

As perviously stated in this blog post series, I initiated the creation of the Running Mate mostly because I needed a demo application for a performance talk. It served its purpose well I think, and I think I can make use of this applications in upcoming presentations. However, being a demo application, it is far from complete in functionality:

  • There is no PDA based version of this code built yet. I.e. the device that tracks and sends the GPS ticks as you run to the server. Obviously without this, there is no purpose of the Running Mate. So I hope that I or someone else will have the time to build this eventually.
  • There is no real Graphical User Interface built yet. I built a test load client for simulating the load and I also built a windows client application for inserting the test data into the database which both are available. But the real GUI is not built yet. I have some ideas for this and hopefully someone will help out with this GUI eventually since GUI is not my cop of tea...

As for all the source code it is available here: http://www.codeplex.com/runningmate. It is published under the GNU GPL v2 license model.  You can quite easily use Subversion (TuroiseSvn client) URL at https://runningmate.svn.codeplex.com/svn or the TFS Server URL at https://tfs05.codeplex.com.

I am usnig SVN myself and unfortunately, the throughput is very low. I suspect Microsoft is actually to blame here since Codeplex is a very popular open source repository these days. Microsoft don't seem to have scaled codeplex to meet the demand. If it does not improve or if I see it is a problem I might move to another availble code repository. We'll see.

The current file folder structure in the repository looke like this:

TheRunningMate_filestructure.JPG

Although this most likely will change in the future, the idea is that a working, non-demo version of the code will be available in parallell with the DemoVersion folder. Eventually..

In the VisualStudio folder, all the C# 3.0 code is placed. I am using Visual Studio.NET 2008. Currently, I am running MySql as the data persistance provider, but I might make more options available too. After all, MySql requires a MySql server to be installed in some way or another (there are quick ways to install it) so it is a bit too much of a hassle to get the application up and running if you are not using MySql. The DB folder has everything you need here though for the application script wise, but please let me know if something is missing.

Hmm, that's it for know I think. I'll back on the topic of design and architecture in an upcoming blog post.  

Friday, October 31, 2008 4:37:03 PM (GMT Standard Time, UTC+00:00)
 Sunday, October 26, 2008

Ok, so this is my third blog post today. Gotta be a record for me I think. :-)

On Tuesday I will be presenting on the topic of performance optimization at Swenug in Göteborg. This last year I have been working quite a lot with this focus at Admeta. The topic of this talk is: 1 billion web request - response time 50 milliseconds. This is actually not a lie since we have these types of requirements at Admeta. One billion request is quite a high number so I do understand if there is a mild hesitation if it really can be true. But asynchronous requests from multiple high load pressure web sites can stimulate this type of requirements, trust me.

I believe the presentation will be approximately 2 hours, but there will be room for some discussions. I've been at a number of Swenug presentations by now here in Göteborg and I think the atmosphere is very relaxed and nice. I hope for the same nice athmosphere on Tuesday with lots of interesting questions and discussions. So this is what I planed and prepared for my presentation:

1. Load testing process and demonstration

Load testing is of vital importance in order to understand how the load pressure will affect your web site. Scaling with more machines is not always something that you can do hastily if the need arises and it sure does cost a lot of money to do it. So it's good to know a little of what you application could behave in production before you launch it. In this part I will go through the load testing procedure, what to look out for, what data to collect, and give various other hints based upon my experience in the area.

2. Performance Profiling with the Running Mate application

For profiling och optimising, I will demo with a new hobby application that I just recently built: The Running Mate. The special thing about this application is that I have built the domain very loosely coupled with regards to the application layer making it possible to switch the domain layer at runtime. I am basically providing these different types of implementations:

a) The Super Hack: this was the running mate application as easy as I could possibly implement it. Not much design work. But fast?

b) The Overkill Design: This application is a bit overkill since the domain model is interchangeable in runtime. I would say that in most cases, this is not how you would normally decouple the domain layer since the need for it often just isn't there. However, it is very useful if you would like to profile performance with regards to different types of domain model implementations. The architecture pattern is that one of the Domain Driven Design (as described by Eric Evans) which gives the system a very nice Separation of Concern I think. One of the provided domain models is using a traditional Data Access Layer implemented in DDD repositories. The other provided domain model is using the Mindscape LightSpeed O/R mapper which we have used at Admeta for quite some time. As you can see in the link it is providing a bunch of nice features and it is very nicely DDD oriented.

So, I think there is enough substance here for a two hour session with discussion. All code demonstrated during the evening will be provided at CodePlex at http://www.codeplex.com/runningmate very soon.

Sunday, October 26, 2008 10:24:03 PM (GMT Standard Time, UTC+00:00)

     This blog post is part of a series that starts here.

I have long distance running as a small interest of mine. It is far from a passion, but I try to get out in the forest and run a distance of approximately 10 km every weekend. I usually run in a park called Hisingsparken here in Göteborg which is a beautiful and peaceful forest to run in. With the courtesy of shapelink.com , here is a map of the 10 km lap that I usually run.

hisingsparken.jpg

Well, beautiful and peaceful isn’t all, is it? The current condition and health situation surely makes running a lot more enjoyable. And in order to get in fit which makes running a great sensation, you have to run faster and push yourself a bit.  So this blog post is basically about finding this motivation with something called the Running Mate.

In order to motivate myself to run a bit faster, I clock the time it takes to run the distance. But unfortunately I seem to be stuck at about 55 minutes for 10 km run which is a bit too long time I think... I know. There are various good ways to improve the time: run more often, vary with shorter distances etc. If lowering the time would have been of really strong importance to me, these ways of doing would probably suffice for me. But as it, my level of interest makes me look in the direction of technical tools to help me out…                          

My problem when I run is probably motivation and focus at the running process itself. I let my mind wonder and I think of everything except keeping the correct pace. Running is great for problem solving by the way. Anyway, the clock does not give me this feedback since I have no idea of what time I am supposed to have when I am looking at the clock during the run. Naturally, this can be solved by having a number of part times at specific distances. And I do, but I don’t really want to keep track of too many of these part times since it disturbs my thoughts on other things. I would like to be able to know instantly, at the time of interest, what my pace is compared with a previous run at that exact spot of the run.

So the answer is obvious: The running mate application. It has been possible for quite some time now to buy a GPS equipped watch with this type of applications. The main idea is that it should be possible to run against yourself, i.e. being able to compare your current running time against a previous time you have had in a previous run at each and every spot of the run.

So I could have gone ahead and bought this GPS device. But something has stopped me so far. Of course it would be cool and exciting to fabricate this tool myself with the help of a mobile phone and a GPS device. Not that I know if I will ever get around constructing the whole thing, but I intend to build something in code and blog about it. I do this partly because it is a fun thing to do, but also since I think this application could be the basis for future examples both on the blog as for presentation I do.

So next blog post, coming up soon I hope, will be about the mathematical geometry needed complete such an application. Fun stuff I think.

Sunday, October 26, 2008 9:39:54 PM (GMT Standard Time, UTC+00:00)

For quite some time now, I’ve been thinking of the design of a so-called Running Mate application. I decided that it was time to implement it and the trigger that set me of was to have a fun example to use at a performance tuning presentation. So beneath is what I have in mind as blog topics although it can change somewhat as I go ahead:

  1. The Running Mate – What is it and why?
    This is a personal touched blog post with the background story as to why on earth I think the Running Mate application is a nice thing. Off course, this blog post also lets you know what the application is actually doing
  2. The Running Mate – Code available at Codeplex
    Source code available and some words about what is provided and what is not provided in the repository as well as some file structure information.
  3. The Running Mate – The geometry calculations
    In order to implement this application some interesting geometric calculation is needed. This blog describes these calculations.
  4. The Running Mate – The Super Hack implementation
    Sometimes I start off by doing a rather quick and dirty implementation of the application and then refactor my way into a more nice design. I didn't actually do this for this one, but I needed super hack implememntation for my presentation. So this is breif presentation of a quick and dirty implementation.
  5. The Running Mate – The Domain Driven Design approach
    In this blog post I transform the application into a design that is closer to a Domain Driven Design.
  6. The Running Mate – The O/R Mapper Repository
    The repositories built in the previous blog post uses a classical database access layer wrapped in repositories with inline (ad hoc) SQL. Here’s an alternative approach with the MindScape LightSpeed O/R mapper.
  7. The Running Mate – The loosely coupled Domain Layer
    Most O/R mappers integrate into the Domain Model rather tightly and make it a bit more difficult to switch from one O/R mapper to another one. This is a bit strange since O/R mappers themselves make the choice of underlying database very flexible. In this blog post I describe how you can decouple a domain model from the application so that you can have several different versions of domain layers that the application can utilize. The loosely coupled domain model is not always that useful in reality, but it is a nice experiment.   

I may change the topic names slightly as I go ahead and write about them, but I hope you can live with this. There are actually many more blog posts that I can write based on this application. For instance I would like to write some more about the LightSpeed O/R mapper and how you can wrap the basic CRUD stuff to make these methods really easy to access with a simple API. Also, there is a lot of stuff on performance tuning this application that I would like to write about eventually. But I better not promise too many blog topics in advance since you never know what lies round the corner.

So. Basically, I am back in the blogosphere for another round.

Sunday, October 26, 2008 9:12:12 PM (GMT Standard Time, UTC+00:00)
 Sunday, February 03, 2008

In a previous blog post, I covered the following topics:

·         Published, not stored which basically allows for more people to read the document.

·         Refactoring structure allowing for documentation to stay agile and up to date with a current content and structure.

·         No special roles, instead accountability for taken actions!

·         WYSIWYG vs. wiki syntax basically stressing that simple editing markup is good enough for most types of documentation.

In this post I will instead dig into the following two topics:

·         Local feedback which allows for history of decisions to be associated to the source of the information.

·         High cohesion and low coupling is a well known programming principle. I think this principle can be applied to documentation as well which is better supported with wikis than in file based documents.

We sure do communicate with each other a lot at our job. This is mostly done in a synchronous way with verbal communication. Most often agile methodologies favor verbal communication over written communication since it is considered as the most effective way.

However, there are other ways of communication which are of an asynchronous nature. Such communication allows us to write information or questions to other people and do other things while waiting for the response to come back.

Asynchronous communication also allows for us to take the time to formulate a good text that correctly describes the important part of the message. Sometimes this is a great strength over verbal communication since in an intense moment we do tend to talk past each other, not understanding what the other person is trying to say.  Of course it can also be a weakness since we don't get an immediate feedback of what we are stating. But this is a completely different blog topic which I probably will write eventually.

However, an example of such asynchronous communication is of course mail, which probably still is our most commonly used communication tool at companies. Yet another example is some kind of chat messenger like MSN Messenger or ICQ which also is of an asynchronous nature. In fact you can find yourself having a multithreaded dialog with someone on a chat application with several topics being discussed at the same time. At least, I know that we programmers often do this. Very effective indeed! :-)

So what about wikis? Let’s look into this now:

Local Feedback

I would say that we often use mail to communicate with each other at work since the asynchronous nature is convenient. However, one disadvantage is that important information as to why we reached a certain decision is persisted in our mail box only. Unless you are extremely organized with a myriad of mail folders, it will become difficult for you to find this mail conversation later on.

 I find that even searching for mails, as gmail states as a big strength of functionality, many times this does not work because I can’t remember the exact words to use in the search... In this case I am left with my structured mail folder hierarchy in order to find the message. After a couple of years there may be thousands of emails in each folder… But then again, perhaps this is only a problem that I have… :-)

Another issue is that information is not published for others to read apart from those in the recipient list. At least for some topics, the information has to be brought out and written somewhere else where more people can read about it. I think that some ”non-secret” topics instead could be published and discussed directly on a wiki omitting the mail dialog. Many wikis offers comments or some kind of discussion board to be associated with the wiki page that can be used for this.

One wiki that successfully uses this approach is Wikipedia. Since everyone is allowed to enter information in Wikipedia, naturally, conflicts of opinion occur frequently. Take a look at this page for instance and please notice that it is the discussion tab. The page contains the discussion of what Inversion of Control is and how it could be explained etc. Unfortunately the meaning of the term is very different from programmer to programmer as you can see. But with discussion, eventually a mature and natural consensus can be reached as to the meaning of the term (ubiquitous language established, see this blog post). Unfortunately not yet so for IoC.

However, the essence here is that the information as of how the meaning of a term was concluded is stored locally and connected to the information itself. I.e. effective metadata! I think this is a great strength.

Naturally, there is always a decision to be made what discussions are to be held in public on a wiki and what discussions are to be held in mailing lists. I am not arguing for abandoning mail here!  :-)

High Cohesion and Low Coupling

I would dare to say that all programmers have heard this statement (and if they haven’t, it would be time to do a little bit of studying. :-)) However easily stated it is not as easily achieved. I also dare to say that it takes years of programming before getting skilled enough to realize the importance of the statement as well as knowing how to apply it well. 

I have often reflected upon lately that successful communication should apply to the same principle. When explaining something to someone, we have to stay focus on the topic. Otherwise, we confuse the audience with too much information (information overload). Sometimes we need to explain a side track in the discussion before we get to our main point. Recognize this scenario? Well, it certainly is the difficult art of pedagogic and it is the importance of having common reference knowledge.

Perhaps being a little bit daring, I think the interpretation as to the meaning of high cohesion and low coupling is quite similar when it comes to communication. Looking at a story to be communicated to someone else, the main focus lies in the main message you want to get across. This information could be compact, i.e. high cohesiveness, which will make it easier to understand.  But it often relies on other information, I.e. it is coupled to the other information. Naturally you would like high cohesion and low coupling to get the main point across quickly. But this coupled information is often what makes the story complete in its context and it gives the story its nuanced and interesting flavors; although making it more difficult to understand.

Having established this interesting parallelism, let us turn an eye in the wiki direction. I have already established in the part 1 wiki blog post that refactoring of the wiki structure is an easy thing to do. This is important since it allows for us to provide pages that have a high cohesion. High cohesion in wikis is pretty straight-forward to achieve since the page refactoring support is there.

However, the thing to look out for is strong coupling. Although a good wiki should be able to update linking between pages when you change them, you may run into many fragmented pages with too many links (high coupling) to other pages. This is where your sense of structure and judgment comes into the game. I dare to say that there is no tool that can do this structuring automatically for you since no tool can predict exactly what you will write.

This is nothing new really and I believe that every good communicator has come to realize this and applies to this principle whether it is in writing documentation or merely speaking to people.

In my next, and perhaps final blog post about wikis, I will have a more practical approach as to how to choose which wiki to use (there are lots of them out there). I can’t say I am an expert of all those wikis, but at least I’ve learned some aspects to look for. So until then, stay tuned.

PS. I probably should admit that my interest in blogging on other topics recently has gained which I might prioritize writing (as well as time spent not blogging…  :( ;-). So if you are interested in number 3 in this series, please let me know and I’ll try to speed up the persistence of that story.

Sunday, February 03, 2008 10:15:27 PM (GMT Standard Time, UTC+00:00)
 Monday, December 10, 2007

I started out this web 2 series with a rather general introduction here. However I have to admit that I wasn’t very specific, nor pragmatic in this blog. This has got to change right here because for me web 2, and especially wikis, is all about a pragmatic approach:

The ability to document necessary and important information and allowing for as many people as possible to read, edit and give feedback upon this information.

This is collaboration. This is wikis.

Unfortunately, documentation often has a poor sound to it these days with the agile winds blowing in the software industry. Don’t get me wrong, these agile winds are definitely good and I think we are on the correct path here. However, I think there still is a need for some documentation. Only, the documentation has to be as agile as the process of developing the code itself. This is where wikis come into the picture as a better documentation persistence tool.

The traditional documentation approach is by using a file-based storage for content. Usually the tool is some version of Microsoft Word which is probably what 90% of what people are using. The editing functionality in this tool is excellent. However, I do recognize a number of weakness as I will note down as I go along comparing file based storage with wikis.

Published, not stored!

A wiki is always reached via a web browser. Therefore, when writing content on a wiki, it is naturally published on a web server for all authorized users to see. This is a great strength since everyone these days are used to a web browser for localizing information.

File based documentation is however often a pain to even locate on a company. Often, such files are placed on a file server somewhere in some obscure directory. Often I find that there are several of these directories too which makes the wanted document even more difficult to find.

However, an interesting approach is Microsoft Collaboration platform SharePoint. Here SharePoint is responsible alone for knowing the actual physical storage of the file and files are only provided as links to the users for download or viewing. This is a lot better approach. Unfortunately, due to licensing costs, a SharePoint solution is often not doable for smaller companies.

Refactoring structure

As when programming code it is difficult to know the exact structure before work has begun. Requirements (input data) may change or you may get new ideas as you work with the code/document. When creating a file based document, the scope for it has to be carefully considered. The information that is out of scope has to be placed in another document which instead is referred to. I find that file based documentation does not leave you much choice for actually editing the scope of the document once you have started working on it. Wikis on the other hand allow you to quite easily refactor the structure and scope as you go along. This since the actual document you are writing is split into several pages reachable via links. It is quite easy to create a new page in a wiki and link to this page which makes refactoring extremly easy. Referencing other file documents in a file document is a much harder this to do. At best you may link to a referenced file document, but this document still probably is a huge source of information so it will still take you quite some time to locate the desired information within this referrenced document.

This refactoring mechanism is one of the largest benefits with a wiki I think. It allows us to split huge sources of information in one document into several documents that are easily linked to from other pages. There is a striking similarity here to the software design Single Responsibility Principle. A class as well as a document should only have one reason to change…

No special roles, instead accountability!

Usually, a wiki does not divide people into authorized and unauthorized groups of people. Naturally, only the group with interest in the wiki may gain access to it. But aside from this authority level, everyone in the group may write whatever on the wiki pages. Usually, this would go for the whole company as long as there are no specific security reasons to conform to.

However, although anyone can edit any page, a wiki should always provide an easy way to see what was edited and by whom. This means that accountability is there since it is always possible to see and compare the different versions of a wiki page. Also, wikis should provide an easy way to roll back to a previous version of a page. 

Having security restrictions often lead to more maintenance and trouble than what it is worth. If there is no top secrets on the page, let people view and edit the information as they want. If a change was bad, well contact the person for a verbal discussion and hopefully roll back the page afterwards after you have agreed upon what should be there.

As far as I know Microsoft Word does not provide any version tracking possibility on file level so this is often added manually in the file instead. However, the SharePoint platform does give you a versioning and roll back possibility for word files. However, I don’t actually know if it is possible to compare different versions of the word file with each other.

WYSIWYG vs. wiki syntax

Microsoft Word offers WYSIWYG editing. I.e. What You See Is What You Get. It means that MS Word hides the small symbols from us that make bold text go bold and underlined etc. I think MS Word does an excellent job at this (although there are still bugs) and the application has definitely reached a mature status.

I would say most wikis are not mature when it comes to WYSIWYG editing. They are far from as feature rich as MS Word WYSIWYG and often you find yourself cussing over a behavior or a bug that you are used to in MS Word. I believe WYSIWYG in wikis will probably mature during the next couple of years and that the difference will disappear.

However, the WYSIWYG editor, if even provided, is often not what the wiki user utilizes (at least not if he is a programmer searching for control of the tool…). Instead he goes directly for the wiki syntax which is simple to use. Unfortunately, there is no standard here and the syntax varies between different wikis. Bold letter in some wikis would for instance be rendered by adding a star between the word: eg. *This text would become bold when the page is saved and published.*

And a small summary

Well, I have lots more to write about wikis but this will have to wait for a future blog post. Probably, this is even now to long for a blog post. Hopefully someone is reading this eventually. And if you do: stay tuned for more…

 

Monday, December 10, 2007 11:26:31 PM (GMT Standard Time, UTC+00:00)
 Sunday, December 02, 2007

Andrew Hunt and David Thomas have a written a great book called The Pragmatic Programmer. This book covers so much great stuff!  Most of the time, while was reading it, I found myself sitting with the jaw against my chest in astonishment of how clearly Andrew and David pinpoints problems and recommendations in software development. I think all seasoned developers would have the same feeling since the problems Andrew and David writes about are well-known, but not very easy ones to actually pinpoint and describe.

As a side note, at the Øredev conference recently, I saw Andy Hunt giving an excellent key note speech opening up the conference. There was quite a number of fascinating subjects he talked about and I hope to be blogging on some thoughts on these subjects in the near future.

Anyway, in the book, the writers bring up a term called software entropy as a force very difficult to avoid for developers. When I first heard of entropy it was actually in chemistry class many years ago. An explosion is an excellent example of a chemical reaction that renders a very high order of entropy. I.e. the amount of disorder of atoms in the explosion is very high in the beginning but rapidly goes back to a low level of entropy. Naturally, this is due to the high amount of energy that sets the atoms in motion.

There is a striking similarity with software entropy I think. When things are heating up in a development team and we are as busy little bees to meet a deadline, entropy is bound to be high. Or at least the risk is very high that the entropy gets high. As a cause of this, Murphy’s Law might appear out of nowhere which seems to be a result of just pure bad luck. But often it is the just the result of high entropy, i.e. the disorder tends to get high as we get stressed out and several accidents happens in a short amount of time.

The writers go on with an analogy to city buildings that are of very different quality in different neighborhoods; some buildings being very clean and neat while others in another area are in a very poor state. This is the effect of “a broken window”. If one window gets broken and it does not get fixed immediately, then soon another broken window will appear; and yet another and so on. Soon the neighborhood will look like skid row and criminality increases drastically.

That this is so, even Swedish governments have concluded. I recently saw a news program stating this very fact. And in the local news paper the same very fact got stated about a neighborhood not too far from where I lived. A whole city block is going to be torn down and rebuild and as a result, criminality is sure to drop it was stated. Well, good!

I think there is an absolute truth in this and that it can be explained with our pride. If you are not proud over the neighborhood you live in, you are not going to respect either the buildings or the people that live in them. But if you feel pride over a good, esthetic environment that surrounds you, you take more care of it.

As for software development, we have the same situation Andrew and Thomas states. If you don’t feel proud over the code that is produced in the project and honor its design, the software will begin to rot. If this happens, sooner or later you probably are going to have to throw it all away and redo the whole thing from scratch.

So, as the authors of The Pragmatic Programmer so wise fully states: don’t live with broken windows. Anticipating that the design of the software is a good one, follow it instead of doing small hacks in order to save time. That time you save may very well be 10 times the time lost further down the road when someone is trying to get the once upon a time nice design to work again as it should be.

I know: Software is never perfect and this is not what the authors, neither I, are saying. However there is a great difference between delivering good enough software and doing “hacks” to the system all the time.

Unfortunately there is a driving force that often makes these hacks necessary: the critical deadline of a promise made to somewhere by somebody by someone... But the underlying reason for this is often due to a crappy or not existing project methodology which is a subject that I won’t dig into in this blog post. However, this spring I probably will write a lot more about this.

 

Sunday, December 02, 2007 10:40:05 AM (GMT Standard Time, UTC+00:00)
 Thursday, November 29, 2007

The first time I heard the word ubiquitous, a sigh of utter and ignorant reluctance went through my mind. I figured that such a beautiful but complex word is absolutely bound to bear an over-complicated meaning to something that perhaps might be very easy. And unfortunately, that killed my interest at the time. Well, having understood the importance of ubiquitous language my interest is gained.

So what does it actually mean? Well, a quick search at my favorite place to look for strange words gives me a hint. When adding the word define: before a word, acronym, abbreviation whatever in google, a search will be done at a number of open dictionaries on the Internet. This is nice since the explanation of the word is given in a number of different contexts which gives me a broader meaning of the word. With this search, define: ubiquitous, 5 different explanations are rendered. The one I choose to show to you is this one:

omnipresent: being present everywhere at once
from
wordnet.princeton.edu/perl/webwn

In Swedish I would translate this to “allomstädes närvarande” which is even more poetic I think. :-) However, the English translation put us a bit closer on the map as to an understanding of the word, but we’re not there yet. What is omnipresent anyway? Is there really something that can be everywhere at once? Sounds like something I want to be…

Well, speaking about ubiquitous language, naturally we are talking about a metaphor. And after reading about ubiquitous languages in Eric Evans book Domain Driven Design and having combined this knowledge with my own experiences in software development, the pieces actually fall together.

Ubiquitous language is all about sharing a common terminology between people. This is an extremely important ingredient in how we communicate with each other. Without a common terminology there is no way that anyone can explain anything to anyone else. Or at least it will become a very, very difficult thing to do.

Let me take an example of this. Imagine that you are about to explain to you six year old son how he is to ride his new bicycle. Only that you are not allowed to use any words that actually describe such things as pedals, wheels, and stepping on the pedals. Of course you can always point at the things and call them “thingie” but try doing that as you let go of the bike and let him take off on his own.  Well, he is bound to crash the first couple of times anyway so I guess this doesn’t matter that much…

It is hard to find good illustrative examples, isn’t it? Well, I am working on my imagination in this area.

Anyway, in software development we have something that is called the domain knowledge. This is the core business knowledge that is associated with the application(s) to be built. Each company have their own business knowledge and thus also their own specific terminology for it.

However, unfortunately the same terminology is not always used across the company and towards customers. Marketing people will use some terminology when they speak to customers when they originally sell the terrific idea. Then developers probably name those very same things to something similar in the domain architectural design. Then suddenly, further down the road, marketing renames a domain term to something else much cooler and, u-hu, the developers are doomed… They feel that this name change is just not worth the pain of changing it in the software design also. Especially this is common when we are talking the database with live production data. Ouch, do not touch it, it may fall apart and it is deadly vulnerable, the heart and soul of it all etc… Once this name conflict has occurred, the terminology is not shared any longer. Instead all developers have to map their domain names to what marking people means with the provided functionality. This is an utter source of confusion.

Of course, a name change is not the only reason for a mixed terminology at a company and there are certainly most often more players involved than merely developers and marketing people. Lacking communication within a company or misunderstanding of the domain model is just as common source of a fractioned terminology.

So where does ubiquitous “thingie” come in? Well, the terminology that we use to communicate with each other should be as understandable and sharable as possible to everyone so that the same words for describing domain knowledge are used. Then we have a much better chance of actually understanding each other. Trying an illustrative metaphor again; it means that we could concentrate on fitting the puzzle together with the help of the puzzle images instead of trying to do the same thing merely using their geometrical size. At least this is the sensation I get when working in such a domain at a company.

If you know of and understand the domain model and you are about to explain it to new-comers in the project, then my advice is that you start with explaining the terminology being used in a document. This will make it easier for other to understand the domain since they can start by reading this before they get an explanation of what the applications actually does. Otherwise, you will most likely use specific domain language words in your verbal explanations that they have not have heard of before. This will probably make your audience miss the main points you are trying to get across.

Also, by extracting and writing the terminology you will get a better perspective of the domain that you consider as natural and simple but perhaps is not. Most likely, you will find names that are confusing and duplicate names meaning the same thing. If so, revise the terminology so that it is correct and up to date. Make sure that this is the terminology that is used throughout the company by discussing with people. Then you achieve a ubiquitous language which will let you stay focused on the real problems and how to solve these. 

 

Thursday, November 29, 2007 7:31:30 AM (GMT Standard Time, UTC+00:00)
 Thursday, November 22, 2007

I guess this is quite a dramatic blog title statement but unfortunately it is true. I am often cursing over regions I find in other peoples code. This blog post will tell you why generally I don't like them.

Both C# and VB.NET allows for a feature called regions. Regions at class level may look something like this:

region1.JPG

Now, the benefit of using regions is that you may collapse them easily when you are not currently working with them. Many regions could then look like something like this

region2.JPG

 Of course, in a real scenario, you would have a more real case choice of selecting regions as to group class members. I’ve seen that it is common to group methods and properties etc. according to member accessibility level, i.e. private, protected, internal etc. Also, it is quite common to group regions of common member functionality;  kind of like having inner classes but categorized as regions instead.

To make things worse, C# allows regions to be defined within members too:

region3.JPG

So, how come I don’t like this? Well I have a couple of reasons for this:

1.       Regions at class level make the code harder to work with. I think most advanced (lazy :-)) .NET developers know that the Visual Studio short cut keys Ctrl + M + O collapses all methods and regions in a class. This action gives a quick and good overview of either the members or regions in the class. Even though you may expand/collapse a specific region with Ctrl M + M, it is quite a hassle to have to expand both regions and methods to get an overview of the actual code within the method. I think that an overview of the functionality of a class is best given by the natural language constructs themselves without using regions. Once you start adding regions to you code, you add an additional expand/collapse step in order to be able to start working with the actual code within you methods. This makes the code harder to work with.

2.       Often, when regions are used at class level, it is done because there are too many members in the class to keep track of. This means that the cohesion of this class is low which is bad. Another, very similar principle, founded by Robert C. Martin, is the Single Responsibility Principle. Regions tend to make you violate this principle since classes become too large and contain too much mixed functionality. More on this in a future blog post…

3.       Regions within methods share a common symptom. When regions are used within a method, it is likely done so because the method is very long. Too long if you ask me. Methods should be short and be easy to read and understand. Otherwise they will break what I usually call the Divide and Conquer principle.  In short Divide and Conquer in software design, as I choose to define it, is a major problem split into many smaller problems by decomposing a method into many smaller methods. This is how you understand and solve a major problem a lot easier since you don’t have to be keeping too much detailed information in your mind at the same time.

4.       When you use regions within a method, it is much more difficult to track the actual data flow between different regions. If local variables are used, and not state fields, you can easy see the API for each method. I.e. you see what input data each method needs and what output data it delivers. Regions within methods do not give you this and the code becomes much more difficult to understand.  

5.       Regions within large methods have another problem: if you receive an exception in operation and if you are logging the stack trace of the exception, you have a much more difficult time to track where the actual error occurred. With smaller methods instead, you will at least receive information in which method the error occurred. (…and of course you should not compile your code with the debug flag to true in operation environment…)

Well, these are the negative consequences of regions that I have come up with so far. Of all these negative aspects of regions, I think the potential violation of Single Responsibility and Divide and Conquer Principles are the worst ones. From what I’ve seen, regions tend to make programmers forget that they are developing in an Object Oriented language and instead program as if using a functional programming language. Sure, functional programming languages have their strengths, but improved readability and therefore better maintainability is not one of them.

So. Is there a place when regions actually are ok to use? Well, if someone has placed a region to group some less significant members of a class, I might accept it although I probably would not define the region myself. However, I will never ever accept regions within methods since I think this violates the principle of Divide and Conquer.

Though, I have found one case when I actually use regions myself. I find them excellent to use when I am constructing demos for course material. Regions let me hide code and comments that I don’t want my students to see yet. Alas, I use regions strictly for educational  purpose. Wouldn’t the world be a better if everything just was a big nice demo…. :-) However, it is not. So lay off those regions in your code. Please.

Thursday, November 22, 2007 10:30:47 PM (GMT Standard Time, UTC+00:00)
 Thursday, November 15, 2007

I started out the chronicle  that I recently wrote giving an angle at the information society we live in today. This is also what I will cover as a starter in this first web 2.0 blog post.

For developers, the information society is very real indeed since the knowledge base required for programming is huge these days. I have only been in the industry for about 10 years, but even in this time I can surely notice the change from when I began. In the .NET field alone, which is my field of specialty, there are thousands of classes that are good to know of. It is not always that documentation provided from Microsoft covers the need that exists.  Also, the number of frameworks, libraries, components, third party open source products, tools etc seem to have exploded the last couple of years. It is not easy these days to call yourself an expert developer of .NET; Nor in any other programming domain for that matter. Most, if not all, people don’t call like to be called experts in such a broad field because of the expectations it may raise. My experience is that an overall humble attitude resides when it comes to programming knowledge nowadays. Something that is quite alright I think. We should be humble for the unknown I think. :-)

Anyway, for developers, the provided information on the Internet has become a reliable source of information. This includes blogs, communities, articles, wikis etc. There is less of a need for developers today to keep track of all intricate details of language and frameworks since there are so many resources available out there. So many people share their experience in blogs and communities which many times makes is quite easy to find a solution to a specific problem.

However, we do have to distinguish between semantics and syntax. Syntax being the language we program in and I dare to say knowledge of the Frameworks provided to us; Semantics being how we program in the language and Frameworks. Both types of knowledge are to be found on the Internet. Semantics, however, is so much harder to learn than syntax knowledge. Semantics deal with the architecture and the design of software and this takes knowledge (lots of reading) and experienced practice (lots of programming).  We are talking years of studying and programming in a professional domain specific environment. The funny thing is that even though I think I’ve reached perhaps the middle of the tunnel, occasionally it seems like I am thrown back to the start of it due to some new experience or gained knowledge. What other profession allows you from time to time to have the sensation of being a rookie again? :-) To me, this is fun. And frustrating.

Well, this blog post kind of made the introduction of what I am hoping to become a series of blog post in the web 2.0 field. I have many thoughts to share, especially when it comes to wikis as software development tool in software projects. So stay tuned for upcoming post if you’re interested of my thoughts.

Thursday, November 15, 2007 10:37:04 PM (GMT Standard Time, UTC+00:00)

For about a year now, I have on a monthly basis been writing a chronicle for the Computer Sweden magazine. I receive a software developer related question in various software areas each month. Most of these chronicles can be found here, but you will need to be able to speak Swedish in order to understand them… J

However, each month I do end up with the same kind of struggle: to shorten the chronicle to the text length I am allowed to have. There is absolutely nothing wrong with this. On the contrary I think a chronicle should be enjoyable and somewhat light weight to read, not covering too much details and especially not be too lengthy. In short: enjoyable to read. Don’t know if I accomplish this really but I do my best.

However, it is really difficult and a very special art of writing to be able to be precise and tell something meaningful on a limited length of text. I believe it was August Strindberg, a quite famous Swedish author who once said: “I do not have time to write short”. Now, I am definitely not comparing myself with Strindberg but I do understand what he means. All too often I have been writing emails to my colleagues at Dotway that perhaps have been a few pages to long (pages being a metaphor obviously... J ). Some colleagues have even coined such long mails as “Tobias mail”… all to my utter frustration of course. I dare to say that I really do try to shorten long mails down, but sometimes this just takes too much time to go all the way. I always do spend long times reviewing such long mails so that the structure is ok and understandable and that spelling and grammatical is ok. Anything else I think would be disrespectful to whomever I am writing to since I am opting for precious time on my account.

As a side note: The last couples of month I have a couple of times successfully changed tactics going from quantity to multiplicity … J Maybe this is the road to take.

When it comes to the Computer Sweden chronicles, the editors leave me no choice and I really have to spend time to be brief and consistent. Even though I occasionally has slipped the quota and received a gentle and friendly mail distributed slam on my fingers from the editors, most often I have been able to keep myself at a maximum of 120% of allowed text length... Anyway, I am thankful to the Computer Sweden for giving me this opportunity to practice being brief and nail those specific points.

So why am I writing all of this? Well first of all because it is my blog. I can write whatever I want in it without bothering if people will read it or not. Second of all, in the last chronicle I wrote, which is supposed to be published soon, I did add a reference in the end of it to my own blog. Why? Because the topic, web 2.0, is huge! I actually have a lot of more thoughts on the subject than what I could fit into the chronicle. And the chronicle being a web 2.0 chronicle, it seems like the perfect ending for it too. J So after this --- ehem --- rather lengthy blog post, I intend to get right at writing a blog entry about web 2.0.  

Thursday, November 15, 2007 10:10:33 PM (GMT Standard Time, UTC+00:00)

This week I finally did something about my blog engine. I have gotten tired of the DasBlog skin I was using so I found another one that I liked. So finally, I downloaded the last version of DasBlog v2.0. It was over 2 and a half years since I looked at the source code the last time (open source) and it seems like people have been doing a great job since then bringing new functionality to it. I am not sure if I like/understand everything that I see in the code yet, but it is definitely an amazingly good open source project. Many thanks to those of you who have contributed with your time to make this possible!

Btw, there might be some errors still on this new site of mine due to missing configuration, so please let me know if you find one. Promise I’ll buy you a beer next time you’re in Gothenburg if you do ;-)

Thursday, November 15, 2007 9:59:43 PM (GMT Standard Time, UTC+00:00)