High Cohesion, Loose Coupling

We are living in a time where businesses and the people running them often change their mind. I won’t be gong into details of why is that so, let’s just say it is a given, and let’s say they are right. It gives them the competitive edge when they are flexible. It is on us to provide that. We are witnessing a high demand for a maintainable software, software that can change easily over time, and where the most of the effort measured in time and people’s work on projects happens after the initial release…long after the initial release if you’re happy. Needless to say, if we want to software to succeed in the long run, we must set our own mindset towards a way, that will provide the businesses their much needed value in that long run.

I know the following is a bold statement, but, you cannot say this enough so that it doesn’t become true.

There is no silver bullet in software development.

The only thing that separates the good software from the bad one is the value of the software for the business at that particular point in time. In order to prolong the value of the software for a long period of time you have to make it respond easier to change.

How you achieve that is a completely different matter. It borderlines with art and being able to predict the future. But, the good thing is that there are a few guidelines that you can follow that can help you out.

Here, I try to put some light on two of those: cohesion and coupling….Read on…

Continue reading “High Cohesion, Loose Coupling”

High Cohesion, Loose Coupling

Find Stored Procedure by Name

There are several ways to find a stored procedure in the server by name: we can query sys.procedures, syscomments, or information_scema.routines. Respective examples would be:

select * from   sys.procedures
where    name like '%name_of_proc%'


select text 
    syscomments c
    inner join sys.procedures p on p.object_id = c.object_id
    p.name like '%name_of_proc%'


select * 
    routine_name like '%name_of_proc%'
Find Stored Procedure by Name

The Story of the Modern Day Developer

Software Developer, a “Programmer” even an “Engineer” or a “Craftsman“, although there are substantial differences between these according to some people, when we say any of them we mean one thing….an organism that transforms coffee into code 🙂 so I will continue with the term “Developer” and I wouldn’t like to go into that discussion right now because it can turn out to become a book.

We have come a long way from being the “basement” nerds, that nobody wants to talk to, to the modern day mixed media served image of super-rich-enterpreneur-programmer(which is sadly just a few lucky ones). So where is the truth? What are we, where are we? How do we manage to form a picture of ourselves and waht we want to accomplish in todays diversity of technologies and approaches to software development?

I know it maybe not much. But, having been there for quite a while both as amateur since I was a little kid typing random programs in Basic on my Commodore 64 back in the 90’s, then professionally since 2005, all the way until today. I will try to share my view and experiences of what I consider the most important values of a modern day developer by answering dozen of questions.

So, here we go.

Continue reading “The Story of the Modern Day Developer”

The Story of the Modern Day Developer

Sql Server: datetime vs datetime2 recap

The MSDN documentation for datetime recommends using datetime2.

datetime2 has larger date range, a larger default fractional precision, and optional user-specified precision. Also depending on the user-specified precision it may use less storage.

Furthermore, datetime2 has a date range of “0001 / 01 / 01” through “9999 / 12 / 31” while the datetime type only supports year 1753-9999. If your need is precesion, datetime2 can be more precise in terms of time; datetime is limited to 3 1/3 milliseconds, while datetime2 can be accurate down to 100ns.

Both types map to System.DateTime in .NET – no difference there.

Sql Server: datetime vs datetime2 recap

Get all stored procedures related to a table

To get all stored procedures related to a table:

Option 1:

 FROM syscomments sc  
 INNER JOIN sysobjects so ON sc.id=so.id  
 WHERE sc.TEXT LIKE '%tablename%'  


 SELECT DISTINCT o.name, o.xtype  
 FROM syscomments c  
 INNER JOIN sysobjects o ON c.id=o.id  
 WHERE c.TEXT LIKE '%tablename%'  
Get all stored procedures related to a table

Sql Server: Delete duplicate rows with CTE

Here’s a code snippet to remove duplicate rows in a table:

 WITH CTE (Column1, Column2, DuplicateCount)  
 SELECT Column1,Column2,  
 ROW_NUMBER() OVER(PARTITION BY Column1,Column2 ORDER BY Column1) AS DuplicateCount  
 FROM TheTable  
 WHERE DuplicateCount > 1  

More on Common Table Expressions(CTE) can be found here:


Sql Server: Delete duplicate rows with CTE

Sql Server: Get all tables containing column with a specified name

A little helper query I came accross, very useful if you want to find all the tables that contain a specific column:

SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
    JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%ColumnName%'


What it basically does is that it will do a join on sys.columns and sys.tables to get all tables that contains that particular column in your Sql Server instance.

Sql Server: Get all tables containing column with a specified name