Sunday, June 20, 2010

SQL tests and various DBMS





Long, long time ago, I was writing a maven plug-in to manage different DBMS systems from an application. As you probably know there are some differences between various DBMS systems, and it is good for your application to take an advantage of a DBMS specific behaviors. In my maven plug-in it was due to performance reasons, but one should be aware that sometimes our approach that perfectly works in SQL Server, will not work on Oracle database. Some mistakes are easy to catch - for example application refuse to work:) Other are really difficult to catch. I remember that one of my colleagues, was not aware about different transaction approaches between Oracle and SQL Server (optimistic vs. pessimistic), and it caused some problems to catch it, cause everything seemed to work fine, and from time to time, everything crashed - because submit was refused to run. Anyway, I always wanted to have some easy database available out of the box that can be installed on most popular DBMS systems, so I can run my tests and check if everything works fine. ChinookDatabase is a tool that I use recently. Enjoy.

Monday, June 14, 2010

Anonymous class in C#




I find it very annoying that I can't create an anonymous class that implements an interface, or includes a method. Actually the only things that anonymous class can have are properties.

Many of people use 'using' statement as a fast way to deal with IDisposable objects, but they forget that it is also useful to quickly create a block of code that is, in some way, isolated from the rest. Some people use it instead of begin/end block, and in some way I agree with those people. If I know that I am doing some operations that won't be useful later on in my function I can put them into a block and release them at the end. I know that I can create a separate method for it, but sometimes putting something in one method is more readable and understandable then decomposition. From the other point of view, when majority of people see using statement they think about IDisposable interface, and they correlate IDisposable interface with unmanaged code. Unfortunately unmanaged code is not the only case to use IDisposable interface and to manually manage the memory management, but I will live this subject for a separate discussion, and return to the main subject. Abstract classes would be an excellent choice for some ideas that I run into during my work. Sometimes I just want to create a temporary container for a short period of time and later on get rid of it, and free some memory that was used during that object modification. Unfortunately because I cannot implement an interface in an abstract class I cannot use it in a usage statement.

Sunday, June 13, 2010

Iron stuff




.NET people tend to tell all those stories about languages that are ported to the .NET framework. Like Iron Python, Iron Ruby... Last week I examined how it looks like for Haskell and Scheme. In the Channel9 movies I heard few times that there is something like Iron Scheme and Iron Haskell, I wanted to compare VS against Emacs editor in terms of fast coding. I found out that there is no such thing as Iron Haskell, but there is a visual Haskell, and it only works for VS2003 and VS2005. It is just an interface via COM, between VS and GHC. This is also the reason why it won't work in VS2008 and VS2010. I've been thinking, what's the point of mentioning that there is a Haskell version for VS if not many people use VS2005 or VS2003 anymore. It is like saying that POSIX compatible application, written on Linux system will compile under MS Windows. Sure it will compile, but only on a Windows platform that was POSIX compliant (has a POSIX personality), and the last version that did that was Windows NT:) In other words telling me that there is an Implementation of Haskell running under VS and on top of .NET is like telling me to get a version of a Windows NT, and still not telling the truth, cause as far as I can see this Haskell does not behave as C# or VB.NET in terms of compilation to IL and running in a .NET framework.

Iron Scheme is a different story. It can be executed in VS2008, too bad that I want to use VS2010. It doesn't give me a power of a .NET framework and ability to use a scheme language. For me writing an application in this hybrid is like a functional-imperative disco polo kind of programming. A good subject for a separate post.

Wednesday, June 2, 2010

What do I read?



I was searching in the market for some good .NET books. I mean books that target not only one programming language, but give you also knowledge about application frameworks available currently on the market that support .NET, or might be easily used by these technologies. So far I was able to find following positions.

For C#:
C# in a Nutshell
C# in Depth
CLR via C#

I hate when the author starts to explain how to do for loop on page 200. It’s such a waste of time. I mean I read a book and I see that probably I know everything that is on this page, so I skip it, and then I realize that I know everything that is in this chapter, so I skip it. And finally I am frustrated, because I don’t buy/read a book to skip something, but to understand something more deeply.
About mentioned positions. C# in a Nutshell is really on the topic;) Not many words but they move attention to specific problems, or features in a way that makes you want to investigate it. Sometimes it motivates you to search more deeply for the solution. CLR via C# is my favorite, on each page I am motivated to search for something; on each page I learn something new. I truly love this book. I believe that it is the best book for an intermediate person. C# in Depth is somewhere between. Good positions to find information that are not mentioned in previous positions.

For SQL:
Inside Microsoft SQL Server 2008: T-SQL Programming
Inside Microsoft SQL Server 2008: T-SQL Querying

Ben-Gan is the man. Haven’t seen a book that starts to explain SQL Server environment, from math, for a long time. I love math, and even if the math in this book is not really complex – you probably seen it all, If you like to study math on your on. But! It turned my attention to connection between some math problems and design of the SQL Server, or T-SQL itself. I enjoy those books so much that I want to get more books written by Ben-Gan, and there are a few to read.

So far I was unable to find anything interesting about ASP.NET, Silverlight, DDD, WF, WPF, and so on. There are so many books made by O’Railly, Manning, P2P, but none of those that I’ve seen is something that I am looking for. The best way for me, so far is to read training kits from Microsoft, like this one. I hope that I will find something sooner or later.

Also I would like to recommend a link to some interesting features of C#. And entire MSDN, I see that this web site changed so dramatically in a previous year, two or so. Now I can really easily find useful information.