Recently I got this error connecting to a SQL Server Compact database from .Net:

"An overflow occurred while converting to datetime."

SQLSo I dug into my data insertion code (I was using the excellent Massive mini ORM by the way – and yes I know its not really an ORM but that’s another post) and found I was setting the offending DateTime field to DateTime.MinValue which it turns out SQL Compact doesn’t like. After a bit of investigation I found that whilst .Net supports a minimum date (DateTime.MinValue) of "01/01/0001 00:00:00" and a maximum (DateTime.MaxValue) of "31/12/9999 23:59:59" SQL Compact’s minimum date is "01/01/1753 00:00:00" (the same as SQL Server 2005 and before). This is the same for all current versions of SQL Server compact. For SQL Server 2008 upwards (2008 R2 and 2012) it’s recommended to use the DateTime2 data-type which supports the same range of dates as .Net.

To summarise:

Version

Minimum Date

Maximum Date

.Net

All

01/01/0001 00:00:00

31/12/9999 23:59:59

SQL Server Compact

All

01/01/1753 00:00:00

31/12/9999 23:59:59

SQL Server
(using datetime)

All

01/01/1753 00:00:00

31/12/9999 23:59:59

SQL Server
(using datetime2)

2008 onwards

01/01/0001 00:00:00

31/12/9999 23:59:59

                          

For a handy guide to the SQL Compact datatypes see here : http://msdn.microsoft.com….

For SQL Server datatypes see here : http://msdn.microsoft.com…

The System.Data.SqlTypes namespace contains the useful SqlDateTime struct which has MinValue and MaxValue properties so you can safely use SqlDateTime.MinValue instead of DateTime.MinValue in your code. For more information on SqlDateTime see here.

About these ads

In my popular post on “The Future of the IT Department” I covered how IT is changing rapidly in enterprises and touched on how business aligned IT teams are going to become more relevant. Some of these agile ‘business focused development and delivery teams’ will be official IT sponsored initiatives whilst others will be somewhat rogue business division sponsored teams working without the IT department as a response to the expensive, often poor quality service provided by the IT division.

The rapid pace of marketplace innovation and the lack of flexibility of many IT organisations within enterprises, when fuelled with the consumerization of IT and the growth of cloud computing is leading to a boom in DIY business application development. Gartner predicts that…

Rank-and-file employees will build at least a quarter of all new business applications by 2014, up from less than 5% in 2007.” [Gartner]

For many years now there has always been the power in the business to harness Excel macros and VBA to enhance end-user productivity, but now this is being enhanced by new friendly end-user tools such as easy  mobile app development, the ability to host new websites in the cloud in a few clicks and a whole SaaS model to replace your IT in house infrastructure over night .  

business-it-supportThe business benefits of this boom are clear to see. The ability of end-users and Business IT teams to manipulate the data and process flows to meet the shifting demands of the market are attractive. Customer demands can in theory be more easily met by those closet to the customer building applications quickly and with their day to day use clearly in mind. As the market changes the user can adjust their homebrew application to fit the market, or throw it away and start a new one. Instead of  a business analysis working closely with the developer to create an application she can reduce the communication overhead by just building it herself. Even if the application is only to be used as a POC this is a very efficient process to find out what works and what doesn’t. In this article on BusinessWeek the CEO of NetApp explains the benefits seen by  encouraging employees to build their own tools, such as cost savings and customer satisfaction. It’s not all peachy though. There are obvious pitfalls to this approach. the IT organisation may be slow and expensive but they often have genuine reasons for being that way. Interoperability, support, security, regulatory concerns, supplier contracts and economies of scale are all topics the IT organisation has to consider and so too does the business if its going to promote this DIY application approach.

Business run IT teams can do very productive work and react quickly to change, but from my experience the problem comes when they have to rely on the IT department to support the implement their change and that’s where tension can arise. Teams outside the IT structure can find it hard to understand the constraints of the IT department. I find developers in business sponsored teams have a real desire to be productive for customers but lack some of the rigor that is prevalent in IT based teams (particularly around maintainability and change control). The IT department can seem to be a blocker to the teams agility when it is unable to adhere to the timescales expected by the business teams. I think some effort needs to be made on both sides to understand the constraints the other teams are under and work together. Critically I feel the IT department needs to realise that this trend will continue and the IT org is at risk of becoming irrelevant (other than to keep the lights on and maintain legacy systems). Perhaps this is the natural evolution of the consumerisation of technology but I do think that IT organisations can have a very relevant role to play in this shift. By sponsoring agile business centric development teams to support the business better the IT organisation of the future can have a very relevant role and IT professionals are ideally positioned to populate these teams and support the growth in DIY applications whilst adding some beneficial structure.


Despite being an age old problem in the IT industry (and presumably a problem in other industries) it still concerns me how we have to rely so much on estimates to manage resources on complex multi-million pound projects. We call them estimates to hide the truth that they are at best educated guesses, or at worst complete fantasy. In the same way that fortune tellers can use clues to determine a punters history and status (e.g. their clothes, watch, absence of wedding ring etc) we as estimators will naturally seek out clues as to the nature of a potential project. Have we dealt with this business function before, is their strategy clear? Will we get clear requirements in time? We then naturally use these clues to plan out the project in our head and load our estimates accordingly but it’s hard to avoid Hofstadter’s Law which states that:

“It always takes longer than you expect, even when you take into account Hofstadter’s Law.”
     — Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid[1]
     

We are daily asked to glare into our crystal balls and come up with an accurate prediction of how long something will take based on very little requirements or even context. How far out are these estimates likely to be in this situation? Well the boffins at NASA can help here with their Cone of Uncertainty 

ConeOfUnCertainty
The cone of uncertainty is excellent at visually displaying the evolution of uncertainty on a project. Based on research by NASA it shows that at the start of a project the estimates could be out by as much as 4x. Whilst this reduces as the work progresses and therefore more is known about the project, it is often at the very early stage where estimates are collected and used as a basis for a business case or to acquiring resources. This is despite the fact that it is known at this point that they are significantly inaccurate.

Estimating is hard and by its nature inaccurate but that is not surprising considering the human nature aspects we have to deal with. These are excellently outlined in this post and they include our strong desire to please and “The Student Syndrome” (whereby we tend to put off until later what we could do now). The post compares overestimation and underestimation highlighting that the effects of underestimating are far worse than overestimating, and concludes…

"Never intentionally underestimate. The penalty for underestimation is more severe than the penalty for overestimation. Address concerns about overestimation through control, tracking and *mentoring* but not by bias."

So underestimating is bad, shame then that we have the concept of the "Planning Fallacy" based on research by Daniel Kahneman and Amos Tversky which highlights a natural…

"tendency for people and organizations to underestimate how long they will need to complete a task, even when they have experience of similar tasks over-running."

There are many explanations of the results of this research but interestingly it showed that it …

"only affects predictions about one’s own tasks; when uninvolved observers predict task completion times, they show a pessimistic bias, overestimating the time taken."

…which has implications for the estimating process and conflicts with the sensible thoughts of many (including Joel on software) on this subject that dictate that the estimate must be made by the person doing the work. It makes sense to ask the person doing the work how long it will take and it certainly enables them to raise issues such as a lack of experience with a technology but this research highlights that they may well still underestimate it. 

In many corporate cultures it is no doubt much safer to overestimate work than to underestimate it. the consequences of this over time however can result in organisations where large development estimates become the norm and nothing but mandatory project work is authorised. This not only stifles innovation but also makes alternative options more attractive to the business, such as fulfilling IT resource requirements externally via 3rd parties (e.g. outsourcing/offshoring).

Close up shot of calculator buttonsThe pace of technological change also fights against our estimating skills. The industry itself is still very young and rapidly changing around us. This changing landscape makes it very difficult to find best practice and make it repeatable. As technologies change so does the developers uncertainty of estimating. For example, a developer coding C++ for 5 years was probably starting to make good estimates for the systems on which he worked, but he might move to .Net and his estimating accuracy is set back a few years – not due to the technology but just his familiarity with it. It’s the same for Architects, System Admins and Network professionals too. As an industry we are continuously seeking out the next holy grail, the next magic bullet and yet we are not taking the time to train our new starters or to grow valid standards/certifications in order to grow as an industry. This was a challenge that many professions in history have had to face up to and overcome (e.g. the early medical profession, structural architectures, surveyors, accountants etc) but that’s a post for another day.  

Ok, ok so estimates are evil, can we just do without them? Well one organisation apparently seems to manage. According to some reports

"Google isn’t foolish enough or presumptuous enough to claim to know how long stuff should take."

…and therefore avoids date-driven development, with projects instead working at optimum productivity without a target date in mind. That’s not to say that everything doesn’t need to be done as fast as possible it just means they don’t estimate what "fast as possible" means at project start. By encouraging a highly productive and creative culture and avoiding publically announcing launch dates Google is able to build amazing things quickly in the time it takes to build them, and they are not bound by an arbitrary project deadline based on someone’s ‘estimate’. It seems to work for them.  Whether this is true or not in reality it makes for an interesting thought. The necessity for estimates comes from the way projects are run and how organisations are structured and they do little to aid engineers in the process that is software development. 

So why do we cling to estimates? Well unless your organisation is prepared to radically change its organisational culture then they are without doubt a necessary evil that whilst not perfect are a mandatory element of IT projects. The key therefore is to improve the accuracy of our estimating process one estimate at a time, whilst still reminding our colleagues that they are only estimates and by their nature they are wrong.

Agile estimating methods include techniques like Planning Poker (LINK) which simplify the estimating process down to degrees of complexity and whilst they can be very successful they are still relying on producing an estimate of sorts, even if they just classify them by magnitude of effort. I was just this week chatting to a PM on a large agile project who was frustrated by the talented developments team’s inability to hit their deadlines purely as a result of their poor estimating.

There are many suggested ways to improve the process and help with estimate accuracy and I’m not going to cover them all here, but regardless of the techniques that you use don’t waste the valuable resource that is your ‘previous’ estimates. Historic estimates when combined with real metrics of how long that work actually took are invaluable to the process of improving your future estimates.

Consistency is important to enable a project to be compared with previously completed one. By using a template or check-sheet you ensure that all factors are considered and recorded, and avoid mistakes being made from forgetting to include items. Having an itemised estimate in a consistent format enables estimates to be compared easily to provide a quick sanity test (e.g: "Why is project X so much more than project Y?"). It also allows you to capture and evolve the process over time as you add new items to your template or checklist as you find them relevant to the process. Metrics, such as those provided by good ALM tools (e.g. Team Foundation Server or Rational Team Concert) are useful for many things but especially for feeding back into the estimating process. By knowing how long something actually took to build you can accurately predict how long it will take to build something similar. 

In summary then, estimates by their nature are wrong and whilst a necessary evil of modern organisations are notoriously difficult for us mere humans to get right. Hopefully this post has made you think about estimates a little more and reminded you to treat them with the care that they deserve in your future projects.


I like Ubuntu and I enjoy using it, although I’m still a windows guy at heart (at least for the time being anyhow but we’ll see if Win8 ever grows on me) and I use a lot of Windows only apps. The approach I’ve been using for the last few months with great success is VirtualBox’s Seamless mode.

SeamlessModeImage

I run Ubuntu in a VirtualBox guest VM on top of a Windows 8 host (although it could be the other way around) and when its running I run it in Seamless Mode. My virtual Linux PC is then running in a normal desktop window and my mouse and keyboard works seamlessly between them.

SeamlessDesktop 

I effectively have two desktops here, my Windows one and my Ubuntu one. If you set up a shared folder between the two machines within VirtualBox its easy to share files too. Of course you don’t get the performance benefit of running Linux directly on the hardware as you would with a dual boot configuration but dual booting doesn’t provide the ability to interact between the OS’s. 

This approach is the best way I’ve found yet to run Linux and Windows together.

You can also go further for some OS configurations and use Seamless Windows if your setup allows, which enables your guest OS windows to be displayed side by side with the host OS’s windows.


If you haven’t checked out TFS Service from Microsoft then I thoroughly recommend trying it out. It is basically a TFS instance in the cloud and at the moment its free for everyone to use and there’s an official a free plan for small projects up to 5 users. I run a small TFS instance on my WHS but I’m planning on switching completely to the TFS Service offering to avoid having to manage a TFS installation locally.

image10

One thing that caught me out was the issue of naming your TFS Service Account. I didn’t give much thought to it initially but then once I found how good the service was I began to wish I’d named it something more appropriate. Well, as the TFS team are releasing service updates at such a rapid cadence I didn’t have to wait long for a rename feature. The process to rename your service account is detailed in Brian Harry’s blog here.

Even if you are not enthusiastic about a cloud based centralised ALM tool I recommend checking out Brian Harry’s blog anyway for informative posts on how his team is managing three week sprints and continuous delivery within Microsoft. What this team is delivering for their customers is impressive.


Just Do It !

08Jan13

nike-just-do-it1Now I’m not a big fan of New Year’s Resolutions and in fact have the same one each year which I religiously stick to, which is to never make any New Years Resolutions. However whilst we are all in the spirit of renewed enthusiasm for the new year ahead I’d like to quote the great tag line of the Nike brand:

“Just do it!”

We all speak to people who have a great idea for the next big thing be it a concept for a new phone app, a great web site or a business idea that could make a fortune. For some it will always be just a vision in their head, some will get started but get distracted or bored, but very few will get their ideas off the ground. Be different, get that idea out of your head and into the real world because as Woody Allen said…

“80% of success is showing up!”

So if you have an idea, a domain name gathering dust or some half finished code lying around then either move on and forget it or do something about it. Even if it fails you’ll learn a lot along the way.

justdotit2If the task seems just too big, then check out this excellent post by Jim Highsmith where he talks about just getting that project started and focusing on delivering value. For more ideas on getting started with just the bare minimum features then check out the the Minimal Viable Product (MVP) concept used by many start-ups.

Oh and don’t forget – if you become a millionaire on the back of this post, don’t forget me :-)


I previously blogged how I value podcasts as I find them an excellent way to maximise the use of my daily commute time. I thought I’d provide an updated list of the technology related podcasts I subscribe to:

  1. PC Pro podcast (UK based PC magazine’s show)
  2. TechSNAP
  3. Hanselminutes
  4. NET Rocks! 
  5. Coder Radio 
  6. Herding Code
  7. Software Engineering Radio
  8. Pluralcast
  9. This Developer’s Life
  10. PowerScripting Podcast
  11. RunAs Radio
  12. The Linux Action Show
  13. The Home Server Show   
  14. The Tablet Show
  15. The Digital Lifestyle Show
  16. Microsoft Channel 9 – This Week On Channel 9

Have you got any other shows that you’d like to recommend, if so just leave a comment.




Follow

Get every new post delivered to your Inbox.