A Developer WeBLOG RSS 2.0

Today's meeting started out with the usuall news on what's been happening on the last month and what has came out of today's PDC. Richard Banks mentioned about Windows Azure, an IoC adapter project in codeplex, and some other web development related stuffs.

The first session is about NHibernate, which was conducted by Damian MacLennan. Its cool to know that NHibernate is a very flexible ORM framework. Its not an implementation of an Active Record pattern, like Linq to Sql is. Its more like an Implementation of Data Mapper pattern. The first few examples was quite understanable, but as it gets deeper to a more complex mapping, its getting kinda blurry. Its a very interesting framework though, definately going to try it sometimes.

In the second session, Ali Shafai talked about ASP .NET MVC. Unfortunately we were running out of time, so the whole presentation was kinda rushed. Having said that, he delivered a very good presentation too. Man, he was a very funny guy. One of the things that I found interesting that he said ASP .NET MVC can be RESTfull. I thought ASP .NET MVC is a bad example of RESTfull architecture, because the URI will actually point to a controller class as opposed to resource location in the server. Let's take this uri www.rwendi.com/store/product/shoe as an example. Now in RESTfull, I would expect to find a "Store" resource location, in which I would expect to find a "Product" resource location, in which I would expect to find a "Shoe" resource location. But in ASP .NET MVC, those are not resource locations, they're merely pointing to a controller class which may contained within a single resource location.

It was a good ALT .NET meeting, enjoyed it alot. Definately looking forward for the next one. You can find the official meeting summary here.

Some of the interesting news mentioned:

  • Free version of Hyper-V Server Link
  • Common Service Locator (a common API for IoC Containers) - Link 
  • DotNetRocks IoC Web Cast - Link
  • Utility: Contig - defrag a single file Link
  • Crack.Net (access the internals of any .NET desktop application) - Link
  • JQuery Intellisense Support - Link Download
  • Watin 1.3 (now with Lambda support) - Link

RWendi

Tuesday, October 28, 2008 12:24:13 PM UTC |  Comments [0]
ALT .NET

One of the things that I've been trying to do lately to improve myself as a software developer is to apply TDD (Test Driven Development) to my day to day development work.

A little bit introductions on TDD, TDD is a Software Development methodology where test cases are written first to accommodate Software requirements/specs and then Codes are written afterwards to fulfill the tests. The whole idea is to let your tests dictate or drive your software development, i.e. "Your codes are born out of your tests". Codes that are written using TDD will be much simpler in general, because they are written just to pass your test cases. One of the problem that might arise when you write your code first is that you tend to get carried away and overcoding your solution. In some cases overcoding your solution can be a bad thing, because overcoding means you over-complicate things, things that are not necessarily have to be be implemented to fulfill your requirements.

The basic iterations of TDD is as follows:

  • Write your test case
  • Run your tests (the new one should fail)
  • Write your code
  • Run your tests (every test must passed)
  • Repeat

What Im hoping to achieve by implementing TDD is that, I want to overcome my habit of overthinking something (as I mentioned here). TDD should help me to set my mind to focus more on whats really important, which is to implement a solution that targets the required specification, nothing more and nothing less. Just as Rob Connery said in his MVC Storefront series, "TDD helps you to always challenge your assumption. Don't ever assume the code that you're writting is going to be needed unless if you test it first."

My first experience with TDD is a mix of good and bad. One of the first thing that I feel when doing TDD is that it feels weird to write my test case first. It's really hard to have the mentality to write the test case first, as I am very much used to just code away and worry about testing later. I have to admit that its not as easy as it sounds. Due to this I was not able to be as productive as I could be. Moreover, the fact that my company doesn't use any unit testing framework at all doesn't help for a bit. In fact I had trouble using VS2008 Unit Testing tool, it gives me compile error due to some project reference located in a network path. Couldn't be bother to fix it, I tried NUnit and it works like a charm.

Having said all that, after a few of TDD iterations Im starting to feel the benefit of TDD. Everything that TDD tries to achieve starting to make sense. From writing your test based on your requirements, to write your code to pass the test, and to produce another test (one test leads to another). Feels like it gives some rhythm to the way you write your solution. Unfortunately due to time constraint, I had to cheat my way to finish up my solution. I guess I still need some times to get used to it before I can really be productive again when using TDD. Anyway, I think the whole experience has been very positive and I will definitely keep on trying to apply TDD on my development work.

RWendi

Tuesday, October 21, 2008 12:21:46 PM UTC |  Comments [0]
Programming | TDD

ALT .NET Meeting #2 (website)

Where:
ThoughtWorks Sydney Office
Level 8, 51 Pitt Street
Sydney NSW 2000 Australia
[Map]

When:
Tuesday, October 28th 2008
6pm - 8pm

Topic:
ASP .NET MVC
NHibernate (ORM)

Agenda:
6:00 pm - Welcome and News (Including a group chat whatever has come out of PDC)
6:15 pm - Pizza and beers.
6:45 pm - Session: "Using ASP .NET MVC with NHibernate". Presented by Ali Shafai & Damian MacLennan

Monday, October 20, 2008 9:14:22 AM UTC |  Comments [0]
ALT .NET

Got sick with the old theme, decided to change it. Im still using one of the default themes, the business theme in particular. Im in the process of creating my own dasBlog theme to get that more personalised feel, although Im not sure when I will have the time to do it. Until that happens, I think I can live with using the default themes. They don't look too bad anyway.

Im thinking of adding a wikipedia to this site for storing informations that I came across in the web. I found that I lost information ALOT. You browse the web, found something interesting and then completely forget about it in the next few days. I think its important if you store that information somewhere. That is where I think a wikipedia would be very usefull. ScrewturnWiki is the candidate for the wiki. It's free, opensource and preety damn solid wiki system. Going to install it next week, after im finished tweaking the css theme.

RWendi

Friday, October 17, 2008 9:59:34 AM UTC |  Comments [2]
General

These past few days I had a couple of shocking discoveries in some of our libraries. Not sure if there's an official term for it (maybe code smells?), but basically these are my discoveries:

  • A view class is being decorated with methods that belongs to a business logic class. Some of these methods provide validation logic, while some others are doing business logics inside the View class.
  • A business object class has methods that takes in a view object as one of its parameters

To me these are just not right at all. In the first example, the view class should not be doing any complex processing that relates to business object. If a view class contains business logics, that would mean I have to use the view class to reuse those business logics. Classes that belong in the view layer are responsible solely to display or update the view based on a given model. Any processing logic that doesnt involve in displaying or updating the view, let alone doing stuffs to the business object, should be delegated to the business logic layer. The only exception to this is when the interaction between the view and the business object is simple enough. Simple operations like setting properties of the business object that requires no business logic at all.

In the second example, the business object class should know nothing about the view class. It doesnt make sense to pass your GUI to your business object, What the hell is it going to do with a GUI anyway? A business object should not directly change a view state in anyway. Im a pure believer that classes in the business object layer should be as light as possible. Business object layer has a sole purpose to represent your model in memory and perform CRUD operation to the data layer. If your business object is doing logics other than CRUD operations, those logics should be refactored out to the business logic layer.

Speaking of software layers here is the basic view of software layer stack to my understanding:

Idealy, the responsibility of each layer is as follows:

  • A View class is responsible to initialize, update, and displaying GUI to the user. Any communication between a view and a model should utilize a controller class to do the job. As stated above, the only exception here is when the interaction between a view to a business object is simple enough (requires no business logic).
  • A Controller class is reposible in controlling actions. It decides what action to take when there is a change in the model OR when there is an interaction between the user with the view. This may be updating a view or executing a business logic.
  • Business Logic is where you put all your domain's or model's logic.
  • Business Object represents Your domain model in memory as an object. It may communicate directly to the data source or it may utilize an entity class to abstract data source.
  • Entity is an object representation of your data source. Why not use business object instead? If you use your business object, you are essentially coupling your business object to your data. This means if the datasource change you're screwed. Moreover, you don't want to make your business object class dirty with all those data mappings logic.
  • Data is your data source.

These layers should be implemented as loosely coupled as possible to achieve better design for greater reusability and flexibility. By doing the examples aboves you are basically coupling some of these layers together, because its doing more than it should. Any class should only has only one responsibility. If a class has more than one responsibility, then you should consider refactoring it.

RWendi

Tuesday, October 14, 2008 11:09:46 AM UTC |  Comments [0]
Programming

I was given a task to port our comparison engine written in native c++ to run in a 64 bit environment. Without modifying anything, I found out that the engine works in 64 bit environment without any problem. But to be compliance, I was still required to get the engine code compiled in the 64 bit compiler. Sounds like an easy task, but it isn't.

The problem is that the engine is compiled using Visual Studio 2003, and VS2003 support for targeting 64 bit environment is pretty much non-existent. Now, I can just convert the solution files to VS2005 or VS 2008 as both of them support multi-platform targeting. I tried that actually and the compiler didn't like the current engine codes, I got lots of compile error. So I reckon by doing that I introduce a whole new set of problems. So that’s not an option.

After some researches, I found a website that suggests that in order to compile VS2003 I have to download "Microsoft Platform SDK". The Platform SDK is an older version of "Microsoft Windows SDK". In there, there's a 64 bit compiler. All you need to do is to change the environment to be 64 bit and then launch VS2003 and specify to use the default environment. Once you've changed the environment, you can't changed it back to target 32 bit without restarting Visual astudio. Thus you need a batch files that will change the environment and launch Visual Studio, which looks like these:

X86 batch file:

call "c:\Program Files\Microsoft Platform SDK\SetEnv.Cmd" /XP32 /Retail
call "dx_setEnv.Cmd" x86
Start "" "c:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" /useenv

X64 batch file:

call "c:\Program Files\Microsoft Platform SDK\SetEnv.Cmd" /XP64 /Retail
call "dx_setEnv.Cmd" AMD64
Start "" "c:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" /useenv

To confirm you're using the right compiler, you can go to: Tools -> Options -> Projects -> VC++ directories. You will see that the directory now targets the compiler inside the Microsoft Platform SDK folder.

Using the SDK compiler doesn’t work straight away, Im getting the following compile Errors:

error LNK2001: unresolved external symbol __security_cookie
error LNK2019: unresolved external symbol __security_cookie referenced in function _store_winword
error LNK2001: unresolved external symbol __security_check_cookie
error LNK2019: unresolved external symbol __security_cookie referenced in function _store_winword

This is due to the "/GS" switch being set by default by the platform SDK compiler. The code for the "GS" switch resides in the C Runtime Library, which is the default library that is pulled in by the linker in Visual Studio. However, the version of the runtime library included in Platform SDK is not the same as the one in Visual Studio. Thus in order to fix this issue you must include the "bufferoverflowU.lib" in the Project Linker Command Line, i.e Project Properties -> Linker -> Command Line -> Additional Options.

That’s my journey so far in trying to make VS2003 to target 64 bit environment. Still having some issue with the compiler, when it's been resolved will update this post. Anyway, I highly recommend to visit sites on the references, as most of the stuffs written here are coming from there.

Rwendi

References:
http://www.toymaker.info/Games/html/64_bit.html
http://support.microsoft.com/kb/894573

Thursday, October 09, 2008 12:50:51 AM UTC |  Comments [0]
c++ | VS2003

I have to say that it was a great event, i had a blast. The atmosphere was great, the food was great (pizza, beer and softdrinks), people were so keen and enthusiastic, and a great meeting place to be.

There was a bit of technical glitch at the start of the event that left many of the atendees stranded on the ground floor for like few minutes, because level 8 is not accessible after 18.00. I actually was in the group that went up and down inside the lift for like 2-3 times, hoping that someone had the swipe card to level 8. The other people on the ground floor got mad, because the only lift that worked was full of us. It was a fun experience. Anyway we started a bit late, Richard gave a couple of news of what has been going on in the development world, and after that we had our meal followed by the presentations.

The first presentation was about Ruby on Rails presented by James Crisp. The presentation was top notch, he delivered it perfectly. It was brief, systematic, and very informative, I liked it alot. I have never tried ruby before nor have i seen one, but after the presentation, it makes want to try it. It looks like a very fun language to learn, definately putting this in my TODO list.

The second presentation was about Rhino Mocks presented by Richard Banks. His presentation was more like giving ideas of what you can do with mocking. He didn't give no background whatsoever about mocking and reasons why the concept is there in TDD or why we should even bother of using it in our testings. In my opinion it would be nice to have a little bit of introduction about mocking, just to give a bit of an idea to those who knows little about mocking like me. Having said that, Richard delivered a great presentation as well. After seeing examples of mocking, I asked my self "dang, why didn't i know about this before?". Mocking is such a great way to isolate your testings. Who cares bout other classes, I just want to test this bit and just mocks the other. Easy, problem solved!! Funny I must say, Richard Banks attitude towards software development reminds me a lot of my Senior Architect Paul Doessel.

Another great thing about the event is that, not only the presentations were very usefull, but the interaction and the atmosphere in the meeting room was very positive. People were collaborating, the presenters were not the only who gave answers, but there were many others that show as much as expertise as the presenters. There was no doubt, lots of people with great minds attended the meeting.

Overall, I think the event is a big success. I definately looking forward to attend next month's meeting, especially they're going to talk about my topic ORM (NHibernate in particular).

Some Resources:

Wednesday, October 01, 2008 11:31:49 AM UTC |  Comments [0]
ALT .NET | Programming
All Content © 2010, RWendi