When To Code To an Interface

When to code to interfaces? In my opinion only when you have to “INTERFACE” with a 3rd party component, or some external piece you might have to interact with. Writing an interface for every concrete class seems way to redundant. It is probably easier to convert a concrete class to an interface when you need to instead of coding and Interface and Class or every entity object you want to created. What you end up doing is just duplicating code that you will never use.

Oh yeah, your UML (who even uses UML?) will look good, but its usefulness is lacking. I say write interfaces for things like File System interaction, Database interaction, some other 3rd party or external thing you need to interact with. Then you can easily swap out the backend later
if you need to.

I just don’t get writing say, and IPerson interface for a Person object. They are just going to be exactly the same. Down the road I don’t see you swapping it out for a new “Person”. Maybe but at that point, you might as well just create your IPerson and then create your APerson, BPerson that use the IPerson interface.

I guess what I am saying is follow YAGNI (You aren’t gonna need it) principle, and you will see the benefits in your code.

Don't Be Afraid to Question "Why Are We Doing It This Way?"

"A boy asked his mother how come she cuts off the edges of a pot roast when putting it into the pot. Mother told him that that’s how her mother taught her to do. So, boy went to his grandmother and he got the same answer. Then he went to his grand-grandmother and ask her the same question. The answer was: Well, back then my pot was to small and the meat didn’t fit inside." – Steve Maguire’s book Debugging the Development Process.

Sort of playing off my last post

IT and Development Best Practice: Just Because You Can Doesn’t Mean You Should..

You shouldn’t be afraid to as "Why are we doing this again?" Usually in business and IT/Development the answer is: "That is the way it was when I got here, so we just kept doing it that way." Now I am not saying that every practice and procedure in place is bad or wrong, what I am saying is that you should not be afraid to ask why a certain thing is done the way it is done.

"Why are we using batch files to do XYZ?" – now we can use VBS/C#/PowerShell/One Line CMD, etc

"Why are we using MS Access as a backend?" – now we can use SQL2005!

"Why do we have 18 steps to get something approved?" – now we can streamline it and speed up everything!

"Why am I doing more documentation than programming?" – documentation goes out of date 2 minutes after it is completed, let’s self-document our code with unit tests!

"Why do I spend more time in meetings that actually working?" – do you really need to be in all those meetings? Can it be solved without a meeting? Via Email? Phone? Small face to face talk?

and the list keeps going, but you get the idea…

Always question "Why?" and sometimes you will see that things are just being done because that is the way it has always been. Don’t be afraid to change things when you do see they need to be as well. Like it is always said – "there is always room for improvement"

IT and Development Best Practice: Just Because You Can Doesn't Mean You Should..

One thing I have learned over the years in IT and Development is this: Just because you can do something doesn’t mean you should.

What does this mean? It means that sometimes software and programs and hardware will let you do thing/configure things in such a way that is possible in the software, but that doesn’t mean you should do it.

Some examples:

1) Development – You can add a gazillion button controls to a form. Your development IDE doesn’t complain at all. You run your program and it totally dogs or has weird issues. Why? Because common sense tells you that shouldn’t put many controls on a form, you need to redesign! Some guru’s (Aaron Ballman, Raymond Chen) on the subject have blogged about this and it is talked about all around the web

2) Networking – Windows 98 (and other OS’s – I just know this one is from example) allows you to set two gateways on your adapter. Does this make sense? Two DEFAULT Gateways. Shouldn’t there just be one? I have seen first hand two gateways that don’t talk to each other and then end users sometimes could connect to the Internet, and sometimes they could connect to internal stuff, but not at the same time! Doh!  Chris might be able to add more to this as I am not a networking guru, but I know it just isn’t right.

3) Data Warehousing – Now, The way SQL Server Analysis Services is set up, you have your SSAS server. Then you can make multiple "databases" under that instance. Sort of like regular SQL Server, Instance->Databases->Objects. The thing is, under an SSAS Database, you can create multiple cubes. Now, there might some small instances where you want to do this, but just because the GUI/API lets you create multiple cubes under a SSAS DB, doesn’t mean you should! For one, you can’t share linked objects between SSAS Databases, because both cubes are in the same DB. The other thing is that if both cubes are tightly bound or are mutually exclusive, then you run into MAJOR pains when trying to deploy/process, etc. You risk taking one cube offline because you are having a deployment issue with the other cube. Keep your cubes in separate SSAS databases! πŸ™‚ I ran across this the other day which finally put the nail in the coffin on this issue for me

I am sure there are many more instances where there is the ability to configure or do something but you shouldn’t. It really can lead to major headaches and issues for all involved if common sense isn’t used beforehand. Although sometimes there is an unknown factor and you just have to decide, but then later when you realize it you should go back and fix it (that is probably a good topic for another post in itself!)

Keep geekin!

Time to Reset?

The xkcd comic today says it all, which actually got me thinking about writing this post


Funny, yes. I think sometimes everything just needs to be reset back to zero. I remember back in the day, trying to beat Metroid on the NES and having to leave the NES on for days without shutting it off. Sometimes it would lock up – hit reset. Your computer every day, you probably reboot – time to reset! Development projects – usually they get to a point where there is so much bloat – for small programs and large (Vista was Microsoft’s attempt at a reset) – and you just say, lets start from scratch again, we can do it better.

High school to college – reset. When you move somewhere new – reset. Every year you have your birthday, xmas, new years – reset’s. Sometimes in relationships it is best to just reset – start over, forgive and forget, get back to ground zero – reset. Every day you wake up is another reset, another day to try something new, make something better.

Sometimes things just need to be reset, just to be reset – like the sign above. 2008 is right around the corner, and the new year is usually a good time to reset those bad habits, or just reset goals and timelines, and just get a fresh look on everything going on, should be an exciting year…

Technorati tags: , ,

Programming Home Projects – Like Playing Nintendo?

Ever since I started programming, I have always had some crazy idea on the side that I would be working on, some project, some program I could write. A few have seen the light of day (Fat Finger Media Center, Pocketblogger, amongst others..). I was thinking tonight, and it dawned on me. Doing development projects on your own, at home, is like playing Nintendo. Why? Well I say Nintendo because that is what we did when we were 8. It is like people that call all types of soda pop “coke”, I call all video games “Nintendo”, ok so we have that down,

Doing development projects on your own, at home, is like playing Video Games.

How is like playing video games? Well, everyone who has played video games knows about it, and here is how it goes. You have this awesome game, but it is 1 player. You and your buddy can play together by switching off when you get killed, or if one guy is better than the other, then the other guy just watches, helps, looks for stuff the other guy will miss, goes and gets chips, beers, looks stuff up on the net, etc, a video game co-pilot if you will. Always have to get that Simpsons reference in there too (From the Episode: Alone Again, Natura-Diddily)

BART (playing a Christian video game while consoling Rod and Todd): Ooh, full conversion!
ROD: No, you just winged him and made him a Unitarian.
TODD (after Bart beats the first level of the video game): Can we play now?
BART: We are playing. We’re a team.
ROD AND TODD: [pause] Yay!

See, Rod and Todd are having so much fun, and so is Bart πŸ™‚ – And also, don’t forget cooperative video games! Working together to get to the end – perfect!


No, seriously though, to me it is the same as doing home dev projects. When you do them yourself, it just isn’t as fun as doing them with someone else, as a team. People can bring different skills to the table, which make things better. (artistic abilities for graphics for example, is something someone else could totally bring to the table, even networking, server setup, backend stuff)

Now, if I could just find some motivated people with some extra time that want to learn how to do some cool stuff, and end up making some cool stuff in the process, all the while having fun, well, then, we would be playing, we would be a team.

BTW: I have a couple cool projects I want to work on, I have them in my head or semi-started, just need to get motivated!

Source Control At Home: Subversion (SVN/TortoiseSVN)

Today, Joel asked me what to do to get source control going at his new job since they don’t have any. He mentioned I have never blogged on SVN or TortoiseSVN at all, so , here goes πŸ™‚

Currently I am using Team Foundation Server (TFS) – which is nice, integrates with VS2005, etc. But really it is only good if you are using VS2005, otherwise it is a pain. What if you have older Classic ASP apps, or PHP or whatever?

This is where TortoiseSVN comes in – I have used it in work scenarios, as well as at home. Easy to set up, and easy to use, and it is pretty scalable if you go bigger, sites like SourceForge now use it.

First thing, you want to download TortoiseSVN here – you can just get the SVN client, its CMD line, works, but is a PITA if you like Explorer Shell integration – use Tortoise.

Once you install TortoiseSVN, it asks you to restart, if you are lazy, just kill explorer.exe and then ctrl+alt+del, task manager, and file->run explorer.exe to get it back, basically it just needs to restart that process to add the shell integration.

Now, you want to create a repo. Right click on inside an EMPTY folder, in the whitespace – you will see some more options, SVN Checkout and TortoiseSVN, then a sub menu.


You want to “Create repository here…” just use the defaults and hit ok, it should tell you have a repo! I made mine


Now if you go to a different folder, and right click, TortoiseSVN->Repo Browser and put your file path in there, you can browse your repo, create folders, etc. Now, you need to import files/project, and then check them out somewhere.

The best thing to do is to go to a project folder say, MyProject, right click, TortoiseSVN->Import , put the path to your repo, a note of “Initial Import” and hit ok. Let it chunk through importing and then hit OK

You are now ready to check out and use the source controlled files. Go to a new folder, called Projects or whatever you want, just somewhere else besides where you are at, and then right click, SVN Checkout. You can browse to your repo, find the folder you imported and then checkout. It will put that in your new folder and there will be little icons on all the files, green icons, because they are good to go.

From here you can modify files, and they will have little red icons, and then you can revert or check in those changes to your source control repo.

Now, with VS2005 (and VS2003), when you build a project, the /bin and /obj directory change every time, and if you are in a team environment, the .suo (user options) file changes too all the time, You want to remove these from source control or you are always going to see a little red icon on the highest level folder. Its best practice to remove any file that changes from some outside force (another common one is in a picture directory, the Thumbs.db file for example)

I left out a lot of smaller details about checking out, checking in, etc, but it is pretty self explanatory. My advice would be to set up a test repo and fool around with it before you put any of your prized projects into it, or make a new repo once you get the hang of it. By the way this is just a “File Based” repo, you can also set up “Web Based” if you have Apace running, but who the heck would run Apace? πŸ™‚

Business Intelligence and Analysis Services in the "Real World"

A reader sent me an email this weekend:

I wonder if I could as your advice as a BI / Data warehousing specialist.I have been studying Analysis Services recently having read a couple of books Which step me through the process of building the cubes etc but as I donÒ€ℒt come From a DB background one thing is not clear to me is how does one determine that They need to use BI / Analysis Services etc in the real world? As you,  I am a .NET developer with a background of building thick client apps and am  Familiar with creating layered architectures etc building on frameworks like NHibernate  Etc to abstract out the DB stuff into my more familiar object world.   My question how does one Generally interface with this Data Warehousing / Analysis Services stuff in the real world? I am looking for answers from people who have used these technologies in anger and not Like me from canned text book examples scenarios etc. Thanks for your time it is would be appreciated.


And I wrote an response, but after reading the response I figured I could post it up here as it is pretty general.

Basically what I have seen is this. You make your application (either web or windows) that saves transactional data, or logs, or something like that. End users usually want reports off of that data. At first, developers will report directly off that data (OLTP database). It becomes slow, and unusable after tons of data is there, so then developers tweak timeouts, things like that. Then the next step is custom summarizations into other tables, and then archiving off transactional data. Usually, because developers don’t know about data warehousing/BI stuff, all this stuff is custom up to this point.


Eventually, someone realizes that, “hey, there is a way to do this better”, which involves a structured ETL either using stored procs or SSIS or something similar. Also, instead of just ad-hoc or custom summarization tables, a well designed data warehouse (OLAP) database is key.
Now, from there, you can write your reports off your OLAP database, which is OK because the data is summarized, scrubbed, etc. But you really give it an adrenaline boost when you create a cube off that data warehouse OLAP db, it takes care of the summarization, the relationships, all that. You put the reporting in the hands of your end users (excel 2007 for example) – let them pivot and slice and dice the data, its all ready and set for them to do it, with really nothing you have to do on your end except make sure the cube is processed regularly off the DW.

You are basically abstracting your OLTP data up two levels… In all reality you should be able to query your OLTP data for a time frame and get say revenue, and then query the OLAP and the CUBE and get the same results. Now, with your cube, you can still access data from it in your .NET apps using AMO, which is cool as well, or you can write Reporting Services reports directly off the cube as well, makes it a lot easier than writing custom .NET reports.
So, interfacing with your Data Warehouse, the best options to get data in is usually SSIS packages or stored procedures, no .NET coding really. To get data out, you would probably want to use Reporting Services, or you can query it with SqlClient in .NET apps like you would a regular OLTP database.
The cube, you can get data out using AMO objects in .NET, you can query using MDX, XMLA, etc in management studio, or you can write reporting services reports, but the best client is Excel 2007, its built to be tied to SSAS 2005, so it really works out well.

One thing about all the technologies (SSIS, SSRS, SSAS, AMO, etc) is that there really isn’t a lot online as far as examples and documentation, or it is scattered. It is getting better though. Most of the stuff I do I just have to figure out on my own, through trial and error, but it is OK.

Maybe not the cover all response but it kind of covers what I have seen in the past, from my own experiences, and others.