Posts Tagged ‘Web Development’

How I refactored my Service Class to be “Separation of Concerns” Compliant.

November 23rd, 2010

I’m developing this web application where a users actions is logged at certain places. I initially wrote the logging features into the Main Users Service. I’m currently looking at it now and will be refactoring out the functionality to separate concerns. While to me, at the time, logging a Users action is from a natural standpoint looked like it belonged to the Users service, a more thorough look at it made it clear that the Logging functionality should be it’s own Service.

Don’t see where the mix up of concerns is?

Here’s a list of functionality my Users Service class provided.

  • Creating Users.
  • Reading Users.
  • Updating Users.
  • Deleting Users.
  • Fetching a User by Id.
  • Searching through Users.
  • Counting total search results (I utilise scroll pagination for my record list and dojo datagrid needs to know the total number of records it needs to scroll up to).

Think that the Log functionality is tied in directly with Users since you can’t have one without the other? Well, I did! To the point where the Model automagically handled logging by using the DbTable for the log. At that time, I accepted in my head that Users Log was part of Users and besides, it’s logging; my focus wasn’t on that particular “minor” detail.

» Read more: How I refactored my Service Class to be “Separation of Concerns” Compliant.

To copy and paste or not to copy and paste; adventures in unit testing

November 20th, 2010

Yesterday evening. I started my next coding session. I contemplated the validity of copying and pasting unit tests that have similar functionality, but for totally different domains.

I have developed Service classes for a certain module and I can see this functionality the application of this functionality being similar accross the board. Functionality such as CRUD, Search and Search Result Count etc.

The only things that will be different would be the models it uses which will subsequently be using different DB Tables, but yeah… practically the same methods.

I’ll sit on this for a while, tie up some loose ends and will come back with what I’ve decided….

» Read more: To copy and paste or not to copy and paste; adventures in unit testing

Just when I needed it the most, my weapon of rapid web development goes nuts!

June 18th, 2010

Today was an absolute sh*t fight. Starting from an entire morning where after I experienced several crashes with Visual Studio Express, that I thought I’d try the full version.

To do this though, I had to expand my VMWare virtual disk. So a quick:

vmware-vdiskmanager -x 45GB windevxp.vmdk

… and my virtual disk is now 45GBs! – I then had to resize the windows partition. I’ll post more on this straight after this post.

So with that done, I’m set to install Visual Studio, I thought yeah it should take about 5 – 10 miuntes…

BOY WAS I WRONG!

The installation took like 2 – 3 hours at least, so there’s a large chunk of my day gone. (Great… F*CK!) At this point though, I didn’t care anymore, I was bitter about the amount of work I’ve lost and the disruption caused by stupid Visual Studio Express randomly crashing! I just wanted the whole thing to be installed and start coding again.

» Read more: Just when I needed it the most, my weapon of rapid web development goes nuts!

Carving up designs & Programming like it’s 1999

June 16th, 2010

Well, my current projects at work are a far cry from last year’s mission critical projects where I was on the edge of my seat, tapping my feet to the sound of inaudible rhythm, staring at the screen with unblinking eyes, gritting my teeth as I developed applications in an almost mechanical manner.

Now, I find myself carving up new designs for ancient projects and looking at the code base, I’m honestly surprised that it has managed to not only run, but make bank for the company it belonged to all these years. Caching really does save your ass, so does having a dedicated server you can pump hardware into.

In the past few weeks, I’ve carved up designs, chased several phantom display bugs (which ended up being typos – you would’ve known if you had been keeping up with my tweets) and went back to coding ASP like it was 1999.

Yes you read right, ASP! I’m currently trapped in legacy code world… negotiating screen real estate and dealing with browser laws and rules that change ever so slightly for each different version of browser software!

» Read more: Carving up designs & Programming like it’s 1999

Subversion Tip: Managing SVN Properties with text files

May 21st, 2010

Here’s a quick SVN trick I use for managing my svn:ignore and svn:externals properties for my projects.

One of the first things I do for newly checked out projects is to add a externals.txt and ignore.txt files. Then I just populate these with the property values I require for the project.

I know, it’s a no brainer when you think about it right?

The thing is, I didn’t think of doing it until the past few projects and actually had to rely on ide integrated / gui tools to do it prior to this year. I came across a couple of examples and did it a couple of times in a rush without noting it down, but thought I’d make a post about it on my blog so that I have somehwere easy to find.

» Read more: Subversion Tip: Managing SVN Properties with text files