Posted by Siim on January 17th, 2010
This post is mainly a reference to couple of useful articles about JavaScript. I thought it would be useful to store it in a one place so I don’t need to search from Google every time
Comparing escape(), encodeURI(), and encodeURIComponent()
A quick explanation of differences in these methods and when we should use them.
http://xkr.us/articles/javascript/encode-compare/
Timing and Synchronization in JavaScript
Pretty thorough article about events and different timing problems that may occur. Although it’s 3 years old, all the information is still applicable and I found it very useful to grasp the whole concept of how things are happening on the client side.
http://dev.opera.com/articles/view/timing-and-synchronization-in-javascript/
JavaScript, 5 ways to call a function
Again, very useful article about how we can call a function in JavaScript and what role plays the calling scope. It’s part of the Sergio Pereira’s JavaScript series which you can read from here.
http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/javascript-5-ways-to-call-a-function.aspx
It is worth mentioning that jQuery made that scope handling a lot of easier with it’s latest release.
Posted by Siim on December 6th, 2009
We are using CruiseControl.NET as our CI build server for a while now and it is working fine. CC.NET displayed test results of NUnit and included NCover, NDepend, Simian and FxCop reports for code analyzes. Also produced deployment package and documentation. For build script we are using NAnt which configuration is stored in source control along our projects so all can be controlled in one place. There are only few cons with Cruise Control – it’s based on XML configuration and it doesn’t include proper account management with access control.
So I thought I would try some other CI server and because I heard lot about TeamCity I decided to give it a shot.
Firstly, installation of the TeamCity was smooth and I got it running quickly. Internally it’s based on Java and runs on built-in Tomcat server. By default it uses a internal storage engine but it’s strongly suggested that in production it should be reconfigured to use some proper database like MSSQL or MySQL. I chose MSSQL because it was already installed on the server. I followed instructions on the documentation and got it running. Read the rest of this entry »
Posted by Siim on November 19th, 2009
There has been some discussion over the topic already and there are different opinions. I have been using Repository model all the way so far. I have implemented generic base repository for all common operations and when there are some specific needs (view specific query for example!) for some types then I’ll create specific repository. I know that repositories should be created only for aggregate roots but there I have encountered a little problem. View needs to display data from different entities (aggregates or not) so I cannot always follow the principle of repository per aggregate root. So this poses a problem here – repositories are cluttered with view specific needs. And moreover – repository methods are decorated with sorting and paging parameters which definitely shouldn’t be there. So I decided to change that.
There have been some discussion about using multiple models of the domain for different purposes. For example different kind of a model for reporting purposes. It can even be different kind of data store for that model. Udi and Ayende (didn’t find exact posts anymore) have blogged about that before. Complex views with special needs can be also considered as a way of reporting. In my case, using wholly different model for a view is kind of a overkill so I try to leverage the problem by using query objects separated from the repository. They don’t use repositories by themselves so query objects can be viewed as "specific repositories for views" and they live only in presentation layer. And they don’t operate with domain objects, only with view specific objects like DTOs, filtering specifications. By using this kind of approach, writing complex view specific queries should be pretty easy. I’m not tied to NHibernate criteria, I can use HQL or even ADO.NET. Currently I’m using HQL which returns directly DTOs but I’m thinking of giving a try to LINQ for NHibernate.
When using repositories, I used Expressions to represent sorting and filtering specification. But this seems now overly complex when considering that there were some heavy mappings from string format to Expression format. So now, when it’s only a presentation concern, I can use plain strings, just like they come from the view and do the proper mappings in the query object itself. Like they say – KISS.
Posted by Siim on October 29th, 2009
There are not so many business applications which need multilingual content. I exclude any kind of CMS’s, they aren’t “true” business application anyway, in my opinion. But the current project I’m working on has that kind of requirement – most of the data must be available in multiple languages and users should easily and intuitively browse and edit that data in current working language. Part of this requirement is not so easy to achieve. Especially when there is a constraint that there cannot be a default language in it’s standard term – object may be available in any language and even only in that language.
Currently we are using a single translations table where translation is identified by it’s context which is mostly some sort of object/field key or basically can be any string. All the translatable fields are stored in the entity table also as a “original value”. This solution is far from perfect and do not fit very well into domain model in general. It was meant to be a quick draft of the solution.
Usually, this kind of translation should be invisible in domain model perspective. But in my case I think it should be reflected in domain model also, because it IS one of the purpose and requirement of the business application. There are two possible viewpoints to consider – a technical perspective and a user’s point of view. I’ve explored different models that people have used before and I think that the solution that Davy Brion describes seems the best one.
It is tied to the domain object. That means there are direct relation between entity and it’s translations. It simplifies CRUD operations on it, NHibernate can take care of it itself. Searching from localized versions are also quite simple, performance overhead is minimal.
It uses a single translations table. Actually there are couple of tables, but all translations are stored and accessed from one place. This makes later maintenance simpler and don’t create so much noise in the domain model (and in data model also).
It’s quite simple to extend and it fits perfectly into NHibernate. I find that for my solution I should also apply the default language attribute on the translation, because for different object, the term default language can mean different language from what is global default languages, if such exists.
When using this model, every translatable property (a product’s name for example) is an object which holds at least one localization. We don’t have a term original like I have seen in some models, every value is a localization. This makes things simpler in users point of view.
I don’t write about any technical data, you can check that on Davy’s blog, but I will update this blog post when I do any changes to this model. And I’ll try to provide some samples then.
Posted by Siim on August 29th, 2009
Firstly, I’d like to mention that Windows 7 is really smooth, especially to compared with Vista. It’s faster, reliable and more convenient to use than previous Windows versions.
New launchbar is really effective, more useful than the quicklaunch toolbar, although many of you will disagree on that point, I’m afraid. Here are some of the keyboard shortcuts that make handling of multiple windows and monitors really handy:
- Win+Up: Maximize
- Win+Down: Restore / Minimize
- Win+Left: Snap to left
- Win+Right: Snap to right
- Win+Shift+Left: Jump to left monitor
- Win+Shift+Right: Jump to right monitor
- Win+Home: Minimize / Restore all other windows
- Win+T : Focus the first taskbar entry
- Win+Space: Peek at the desktop
- Win+G: Bring gadgets to the top of the Z-order
- Win+P: External display options (mirror, extend desktop, etc)
- Win+X: Mobility Center (same as Vista, but still handy!)
Posted by Siim on August 26th, 2009
People like to think that having an in-house framework for all the projects with all available different kind of 3rd-party libraries is a good thing. Hey, you can save a bunch of time when you doesn’t have to write common code over and over again, don’t you?
Well, things aren’t so simple. Having some extras always causes some burden on the maintenance. There are plenty of reasons to prove that:
- Framework should be developed separately from projects using it
It adds extra overhead to update the framework, because someone must check if the proposed change fits in the framework. And after the change, projects which use the framework should also be updated. It all takes extra time which could be avoided.
- Who is the charge of the development?
Someone must be the charge of the framework or it ends like a /dev/null – holding bunch of stuff that nobody uses. The one should be responsible of selecting features to add or not to add.
- Tracking framework versions
- Projects have different requirement to fit all
Most of the projects are still quite different by their requirements, so framework may finally contain much code which is used by the one-two separate projects only
- It takes time to develop correct and working framework
All takes time, so instead of creating business value, we spend time to create some internal framework which, in the end, is used only by the single project. What a waste of the resources.
I have participated in a quite a few projects where common frameworks were a hot topic and we tried to make all things so general that it would fit in the framework. But in the end we spent more time on developing the framework than creating the business value, so the projects delayed. There were times when I personally also believed that a framework is a must and tried to create a usable framework before creating some real value (also in my personal projects).
I’m not saying that all the frameworks are bad, I just think that developing your own framework may not be such a good idea. In my opinion, such frameworks should be open source, so the community can be charge of the road.
Posted by Siim on August 26th, 2009
Hello, my name is Siim. I have been in software business about 5 years already, mostly using .NET and PHP. I’m going to blog mostly about technical stuff (mainly about .NET) and software development in general.
Although i read a LOT of blogs, this is my first time when I’ll try to write a blog myself.
I’m not trying to concentrate on any specific topic, I just blog what I find interesting to share and to remember by me. Topics may vary greatly, depends on which kind of a project I’m working at the moment.
I’m also on twitter – http://twitter.com/siimv