As I was so impressed with Linq, in .Net, I was surprised to hear about the java project Quaere, by Anders NorĂ¥s. Had to mention it myself! It doesn’t have the same powerful language support as Linq, but implements sql-like queries on collections as well. A very good initiative, although there are raving discussions going on :)
C# 3.0 language features
August 29, 2007The language is made smart, and I can’t resist also pointing out a new ingenious language feature of C# 3.0 introduced to me at MSDN Live.
var result = new {myText="some string", myInteger=12345, myClass=new MyClass()}
The code snippet will create an instance with these three properties, implicitly declared public as a string, an integer and an object of type MyClass. Of course, Visual Studio 2008 provides auto completion for accessing these properties.
string theText = result.myText
MyClass myClass = result.myClass
It solves neatly the problem of temporary storage of data in a method. You won’t have to declare any more temporary class to store the data. Sweet! :)
Read this article for a preview of what more to come with C#3.0. By the way, wonder why they had to make the version numbers of .Net and C# so confusing? To use C# 3.0, you need .Net 3.5, not .Net 3.0. Oh well. It ships with Visual Studio 2008)
Linq, writing sql in C# ?
August 29, 200727.aug I attended MSDN Live in Oslo. Although mainly a java and open source developer, I’ve worked with ASP.NET 2.0. I used Visual Studio 2005 and web parts, so I do have, if not a leg, at least a few toes in the .Net world as well.
There are some very good things coming with .Net 3.5 and C# 3.0. And the Linq is amongst the best. The introduction of SQL-like syntax in the OO-language first made me sick, but really it’s quite ingeniously the more I think about it. My objective as a programmer is to write easily read, maintainable, and testable code. Now I’m ashamed of my first reaction. Ashamed.
Try writing the following code object-oriented!
IEnumerable<MyClass> result =
from myClass in collection1
where property1 > criteria1
orderby property2 descending
select myClass
Probably looks messy if you are unfamiliar with writing with such a syntax. But if you reflect on the alternative, you’d have to use collections, comparators, ifs, loops and temporary containers. This is beautiful!
Linq is also a persistence API, which looks great as well, but that’s beyond what I wanted to emphasize here.
Scott Guthrie has written a lot about Linq to Sql. Read his blog for in deep examples and exploit the possibilities!
Book: Integration Patterns
August 29, 2007This 400p Microsoft 2004 book covers patterns and practices of system integration. The chapters are fairly independent. As long as you know the terms of integration patterns and solution, you may start reading at any chapter. I chose this book as an entry to learn integration, as preparation to a project, integrating for a financial solution. The book covers something amazingly similar, a Global Bank scenario. As a Microsoft book it, obviously, has chosen Biztalk Server in their code examples and deep dives. But hey! it works. The principles are still the same and terms/patterns as Gateway, Message Brokers, Message Bus, Pipes and Filters and Publish/Subscribe, are thoroughly described.
The Integration Topologies chapter of the book, bravely tries to compare the topologies of integration to a logical topologies and further down to physical topologies. This really didn’t work out for me at all.
Over all, the Global Bank scenario provides a very good example for learning integration, combining different patterns to a complete solution.
On a scale from 1 to 6, I must say… very good! :)
Read more at Microsoft Integration Practices and Patterns
Posted by Ole Morten
Posted by Ole Morten
Posted by Ole Morten