October 29, 2008

TDD in C# - Presentaion @ NotAtPDC

I just attended a presentation from Philip Japikse on Test Driven Development. This was presented through www.notatpdc.com. They have a bunch of presentations on multiple subjects. I really enjoyed and learned a lot from Mr. Japikse. I was introduced to new tools such as MBUnit, ReSharper and also terminologies such as Red, Green, TED, BDD, and DDD.

Red, Green and Refactor are what is known as Test-Driven Development Mantra. Red : Create a test and make it fail. Green: Make the test pass by any means necessary ( even hardcoding ). Refactor: remove duplicate code, hardcoded values, and any code that is not self documenting ( unclear ).

Good rule of thumb: every project should have a test project and every class should have a test class.

Mr. Japikse is going to be posting the sample code and also the powerpoint presentation on his blog soon.

During the session, someone mentioned PEX.

Test Driven Development

This is a new ( ok .... new to me ) software development technique. It is a different way of thinking and process when doing development. It consists of writing test cases covering the desired functionality first before the production code necessary to pass the test. This is a method of designing software and not merely a method of testing.

Here's a few links:

October 21, 2008

Google Calendar Sync for BlackBerry

I have a need to sync my google shared calendar with my calendar. I did some research and found this on google's site. This may be old news to some of you but it is definitely new to me.

Anyhow, check it out. I am currently using it and so far so good.

October 20, 2008

Visual Studio Themes

This may be old news to a lot of people but my boss and I played for a little bit on Visual Studio Themes. So, when I got home from work today, I spent a little bit of time looking for the right theme. So far, I really like this one and it works for both VS 2005 and VS 2008. It is from Rob Conery. Also check out Tomas Restrepo's Themes.

To install the themes, all you have to do is run Visual Studio 2005 or Visual Studio 2008 ( you do not need to open a project to do this ):
1. Go to Tools menu and select Import and Export Settings.
2. Select Import selected environment settings.
3. Select Yes, save my current settings. Choose to back up your current settings. This will help if you decide to go back to the original theme or something goes wrong with the one you are trying to apply.
4. Find the *.vssettings file you want to import and select it. Select the settings to import.
5. Now you are done. You can open up your project / solution and enjoy.

October 18, 2008

VS Live 2008 - Las Vegas - Day 3

Day 3 - Boy talk about information overload.

Best Practices in ASP.NET 2.0 - 3.x
This session basically talks about ways of avoiding to rewrite code. Think about writing a bunch of common libraries that performs simple tasks that would allow you to reuse them, regardless of application. Strings - use constants, static properties, and/or objects.

Cassini vs. IIS - use objects so that you don't have to rewrite code. Using Cassini, ApplicationPath returns / while in IIS, it actually returns a path.

IE8 and its impact of your website
This session talks about some of the new features of IE8. It is currently still in beta. You can find more information here.

In IE8, you can specify document mode for older browsers by using X-UA-Compatible. If you wish to force IE8 to use a specific standard ( for example if you have not had a chance to test your website in IE8 or have determined that some pages in your website breaks in IE8 ... and this is a temporary solution), this can be done in the config (server) level or on the page level. On the server level, you can specify a custom HTTP header ... X-UA-Compatible:IE=EmulateIE7. On the page level, you can use a meta tag like <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />. Remember, page level settings will override server settings.

Accelators is a contextual service to quickly access a service from any web page. It simplifies the copy and paste between web pages. It is described with an XML file

Web Slices allows you to subscribe to content directly within a web page. It behaves like a feed. WebSlices are easier to embed in traditional HTML content and it has a more prominent placement in IE ( favorites bar ).

Data URI is embedding small files directly into the URL. Primary advantage is it does not require a separate download. However, it has limitations such as only usable on <object />, <img />, <link/> and in CSS. No scripts are allowed and maximum size is 32K. You cannot set expirations and base64 encoding can increase size by 33%.

AJAX Enhancements and also CSS improvements.

VS Live 2008 - Las Vegas - Day 2

Jumpstart Your Web site with ASP.NET Dynamic Data
ASP.NET Dynamic Data provides a framework that enables you to quickly build a functional data driven application based on a LINQ to SQL or Entity Framework data model. It annotates the data model with metadata using attributes. Requires .NET 3.5 SP1 and VS 2008 SP1.

Data-Driven ASP.NET AJAX
ASP.NET AJAX is built into ASP.NET 3.5. Also available as an optional free install for ASP.NET 2.0. Things to note when architect AJAX into a data-driven web application:
1. Avoid using AJAX for the sake of using it.
2. follow the "principle of least astonishment"
3. use AJAX to satisfy specific user needs such as providing information to the user quickly, economically, and in context, draw the user's attention to important events, and provide visual feedback during long-running events

JSON - JavaScript Object Notation is a very efficient way to handle data in a browser client. However, ASP.NET AJAX does not expose JSON bindings to the application developer. The JSON libraries enables a developer to serialize/deserialize objects as JSON. JSON.NET and Jayrock are two free JSON libraries and both are free.

AJAX libraries are available. Some of the mature ones are JQuery, YUI, Ext JS, Dojo, and Prototype JS. However, JQuery seems to be the favorite and it is free.

Distributed Caching of ASP.NET Applications
Why do we do this? We are trying to take load off the database, reduce the need to do expensive data operations as often, and decouple caching from any particular platform or development environment. How do we do this? We can use memcached or Microsoft Velocity.

Differences between memcached and Microsoft Velocity are
1. Velocity has a model that is more complicated / sophisticated
2. memcached configuration is done at the application level while MS Velocity is done through a shared folder
3. MS Velocity has the capability to reroute traffice to available cache hosts if one is unavailable
4. MS Velocity also add supports for routing clients, locking and tags
5. MS Velocity is Windows-only. It has only NOT been road-tested to the extend of memcached.

Custom Control for Silverlight 2
Should be familiar with parts model, Visual State Manager (VSM), and generic.xaml.

VS Live 2008 - Las Vegas - Day 1

Here are some notes from a few of the sessions today.

Silverlight for Business Applications
UI from our applications are pretty stale currently. We are not taking advantage of some of the features of WPF and also Silverlight. Some of the cool things that we can do in our UI that would enhance the user experience:
1. Ability to leave a page ( similar to modal ) and when we get back to that screen, the screen remains the same so that the user can finish what they are doing.
2. color coding our screens.
3. Indicating that something has changed.
4. Tooltips does not have to be strings.

Using Silverlight, we will be able to accomplish a lot of these. Silverlight is also cross-platform and cross-browser. You can develop using VS 2008 and Expression Blend. Silverlight also enables some additional browser scenarios like safe isolate storage, and client based file upload controls. It is highly compatible. We have to be careful when we make the decision to rewrite existing applications into Silverlight. We must decide whether we have captive users, how large is the user base, how rich is the data users work with, and does the new system needs a long shelf life? Don't be too ambitious on our first effort.

Another thing to keep in mind is that we do not need to rewrite the entire application. We can rewrite certain pages or new features.
http://www.dotnetmasters.com/


MVC
Model view controller is an alternative, not a replacement for ASP.NET Web Forms. You can find more information at http://www.asp.net/mvc
. Once thing to keep in mind, controller always look for the View with the same name.

ASP.NET AJAX UpdatePanel
UpdatePanel is a control that provides many of the benefits of AJAX without the pain of developing a fully client side environment. It performs asynchronous postback or partila page updates. Server events are fired. .NET Framework 3.5 SP1 provides fixes and also some new features such as History. It provides the ability to enable forward, backward and bookmarks. It must be a simple state. Basically information will be held in the URL. So, don't hold too much information.

Look at ScripReferenceProfiler
or google it. Also check out YSlow. You can also find more information at http://ajax.asp.net/, http://www.aspnetpodcast.com/, and http://www.twitter.com/wbm.

$get is a shortcut method to get to a control. $_GET[''];

ASP.NET Improvements in VS 2008
Multi-targeting Support: allows you to choose which Framework version to target when opening or creating an application.
New HTML Designer and CSS Support. massively improved HTML designer, split view designer, and rich CSS editing support. Find FREE CSS templates at http://www.oswd.org/ and http://www.opensourcetemplates.org/.

Nested Master Pages.

New Data Controls such as ListView, LinqDataSource, and DataPager.

Javascript Intellisense and Debugging Support. Make sure to uncheck the Disable Script Debugging in IE Advance Options.