Entity Framework
Jan 31st
Entity framework is the new kid on the block on the ORM realm. It’s Microsoft new technology for data access, and although it didn’t receive very good comments on its first version, things have been greatly improved in its latest release. It now looks really interesting, with some features which surpass the most seasoned ORM frameworks that have been in the game for years.
Here’s what Entity Framework (EF) has to offer:
ASP.NET 4.5 and Visual Studio 11
Jan 10th
Back in September 2011 the next versions of ASP.NET and Visual Studio were announced. Microsoft has set up a page informing about all of the new features we can find in them. Check them out:
Persistance layer: object-relational mapping tools
Dec 13th
Nowadays it’s very usual to work with object-oriented programming and relational data bases. Relational data bases are all about tables, relations and groups. However, the object-oriented programming paradigm consists of objects, attributes and inter-object relationships. When these objects need to be stored using a relational data base, it’s very obvious that these two models of representing information are very different from each other. We need some kind of translation to transfer data from one to the other.
If we’re using objects in our application and we want to save them, we’ll probably use some data base system. We’ll most likely establish a connection to the data base, create a SQL sentence with the values of the object (or call some kind of stored procedure), and save them to some table. Easy enough, right? Well, this may seem trivial for a small object with 4 or 5 properties. Just consider an object not so small, with 40 or 50 properties. But… what happens with associations? And… what if the object itself contains some other objects? We’ll store them in the data base as well? All of them or just some? What will we do with foreign keys? We can see that, as the application gets more complex, this translation is not so trivial anymore… As a matter of fact, storing objects in the database can become a very usual source of headaches. There are some studies which state that up to 35% of code is dedicated to the role of translating data between the application and the data warehouse.
Parallel programming with .NET
Sep 26th
When I’m talking to people about the new things that Visual Studio 2010 and ASP.NET 4.0 bring, and the easy it is to write code to be executed in parallel, many people just don’t care. They see it as if it wasn’t related to them. It’s true that some kind of applications don’t really need this type of optimization… but that’s not an excuse to try to take advantage of our hardware as much as possible. From several years ago the most common thing in any computer is to have at least two processor cores. As a matter of fact, we’re starting to see now desktop computers with 8-core processors. The trend is to have an ever-increasing number of cores in our computers. This means that any application will have the chance to work in an environment where more than one thread can be executed simultaneously. Besides, nowadays if you want your software to perform faster, you can no longer just move it to a machine with a faster processor and forget about it. We’re approaching the maximum speed a processor can get, so improvements in next CPUs will come from the side of more threads, not a higher clock-rate. I think parallel programming is a key concept all programmers should care about. ASP.NET 4.0 and Visual Studio 2010 bring new libraries, types and tools to ease multi-core development. ASP.NET 4.0 includes the new “Parallel Extensions”, which are formed by:
Some open source projects for .NET you should take a look at
Apr 12th
We all agree that ASP.NET and Visual Studio are amazing technologies with state-of-the-art tools. One requires almost nothing more to write any kind of software – except for a database. However, there are some tools that greatly simplify that task. It depends on what you’re trying to achieve, but I’m sure some of these projects will help you get your tasks accomplished faster and easier:
- NHibernate: NHibernate is a mature, open source object-relational mapper for the .NET framework. It’s actively developed, fully featured and used in thousands of successful projects.
- NUnit: NUnit is a unit-testing framework for all .Net languages, initially ported from JUnit. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages
- jQuery: jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.
- Rhino.Mocks: A dynamic mock object framework for the .Net platform. It’s purpose is to ease testing by allowing the developer to create mock implementations of custom objects and verify the interactions using unit testing.
- MVC Contrib: This is the contrib project for the ASP.NET MVC framework. This project adds additional functionality on top of the MVC Framework. These enhancements can increase your productivity using the MVC Framework. It is written in C#. Founded by Eric Hexter and Jeffrey Palermo.
- CruiseControl.NET: CruiseControl.NET is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework.
- S#arp Architecture: Pronounced “Sharp Architecture,” this is a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate. The primary advantage to be sought in using any architectural framework is to decrease the code one has to write while increasing the quality of the end product. A framework should enable developers to spend little time on infrastructure details while allowing them to focus their attentions on the domain and user experience.
- Spark View Engine: Spark is a view engine for Asp.Net Mvc and Castle Project MonoRail frameworks. The idea is to allow the html to dominate the flow and the code to fit seamlessly.
- TortoiseSVN: A Subversion client, implemented as a windows shell extension. TortoiseSVN is a really easy to use Revision control / version control / source control software for Windows. Since it’s not an integration for a specific IDE you can use it with whatever development tools you like.
- Castle Windsor: Castle Project offers two Inversion of Control Containers. The MicroKernel and the Windsor Container. Castle Windsor aggregates the MicroKernel and exposes a powerful configuration support. It is suitable for common enterprise application needs. It is able to register facilities and components based on the configuration and adds support for interceptors.
Take a look at these projects. I’m sure you’ll be able to find some good use for them in your projects!
Via .NET Zone.
Unit testing
Aug 3rd
A unit test is a piece of code written with the sole intention of verifying that a routine or function behaves as we’re expecting it to. Unit testing attempts to provide a collection of tests to check every method of the different classes the developed program may contain works flawlessly. The general idea is that, if all the parts of the program work properly independently, it’s highly likely that the program as a whole will function as expected. Of course, after all the unit tests are passed, integration tests must be performed as well to ensure the complete system doesn’t have any unintended behavior.
Improving software quality: automatic testing
Jul 13th
Providing high quality software from early stages in the software project is the key to a successful project. We must check the quality of our software in every single release and make sure it’s meeting our expectations. It’s much easier to code having quality requirements in mind from the very beginning than finishing a module and then fixing all the unexpected behavior afterwards.
There are many tools to improve the quality of our work. Developers have refactoring tools, memory profilers, code coverage, etc. But in a software project we also have testing resources, also known as Quality Assurance. Their job is to test the application and find as many bugs as possible: to achieve a high quality product, thorough testing is a very important step. However, this can be a very tedious and time-consuming task. Fortunately, part of this work can be performed automatically using some tools.
HTML 5 C# Web Sockets server and ASP.NET client implementation
Jun 22nd
In the previous post we saw that Web Sockets are the best invention since sliced bread: they bring to the web the bidirectional full-duplex communication traditional desktop applications have been enjoying for quite some time now. It solves many current problems, and enables much more powerful applications than current standards.
I’ve developed a very basic Web Socket server implementation in C# just as a proof of concept. It handles the most basic operations you would expect from a server: start a new connection, disconnect, and send and receive data. Besides, I’ve developed the client part as well using regular ASP.NET. Actually it’s just plain HTML and JavaScript being served from an ASP.NET server – this example doesn’t use any fancy runat=server controls or anything of the like. The functionality is achieved with very simple and easy to understand JavaScript.
HTML 5 Web Sockets
May 30th
Following the series of posts discussing AJAX calls, today we’ll see what is going to be its evolution: Web Sockets. It’s still a very new technology, and support is starting to be implemented in most major browsers and web servers. But don’t count on using it yet, since most of the clients of your web app will not be able to use them. I’ll discuss web sockets here just so you know what the future is going to bring to the web apps world.
The history: the beginning of AJAX
The world wide web and the Internet started as a stateless content delivery mechanism, taking a step backwards compared to traditional desktop applications. Early Internet applications needed to explicitly request every piece of information, and the server sent only the requested data.
Then came what we now call “Web 2.0 application development”: Dynamic HTML, heavy usage of JavaScript, AJAX, and various plugins (Adobe Flash and Microsoft Silverlight). These applications were dynamic and responsive, and they brought much of that rich interactive experience users enjoyed in desktop client/server applications to the Internet. However, due to the request and response architecture that these applications are based on, the latest Rich Internet Applications still cannot match the connectivity and the capability to get real-time data that client/server applications had more than a decade ago.
AJAX call using ASP.NET Web Services
Apr 27th
We’ve already seen quite a few ways of performing AJAX calls: web pages, HTTP Handlers and Page Methods. Today we’ll see how to request data from the server using ASP.NET Web Services.
Web Services are a very general model for building applications, and can be implemented for any operation system that supports communication over the Internet. A Web Service is some programmable application logic accessible via standard Web protocols. It is often referred to as Web APIs as well, since they are a set of methods that provide some functionality through remote method calls. It is a way of offering some of your functionality to all of the internet. But, of course, some kind of restrictions and security can be built into your web services, if that’s what you wish.

