ASP.NET

Tools I want to use more

As a follow up to my tools post here is a list of the tools I’d like to spend more time with. The % next to the title is an estimation as the likelihood I’ll do any serious work with the tool/software/etc.

ReSharper – 20%

http://www.jetbrains.com/resharper/

Simply put, ReSharper is a must-have productivity tool for .NET developers. It fully integrates with Visual Studio to intelligently and powerfully extend the functionality that is native to Visual Studio. ReSharper provides solution-wide error highlighting on the fly, instant solutions for found errors, over 30 advanced code refactorings, superior unit testing tools, handy navigation and search features, single-click code formatting and cleanup, automatic code generation and templates, and a lot more productivity features for C#, VB.NET, ASP.NET, XML, and XAML.

NDepend – 10%

http://www.ndepend.com/

NDepend is a tool that simplifies managing a complex .NET code base. Architects and developers can analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and master evolution by comparing different versions of the code.

C# – 70%

http://msdn.microsoft.com/en-us/vcsharp/default.aspx

NHibernate – 80%

https://www.hibernate.org/343.html

NHibernate is a port of Hibernate Core for Java to the .NET Framework. It handles persisting plain .NET objects to and from an underlying relational database. Given an XML description of your entities and relationships, NHibernate automatically generates SQL for loading and storing the objects. Optionally, you can describe your mapping metadata with attributes in your source code.

NUnit – 20%

http://www.nunit.org/index.php

NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.4, is the fifth major release of this xUnit based unit testing tool for Microsoft .NET. 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.


MEF – 60%

http://www.codeplex.com/MEF

The Managed Extensibility Framework (MEF) is a new library in .NET that enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed. If you are building extensible applications, extensible frameworks and application extensions, then MEF is for you.

DDD – 100%

Tags: , , , , ,

Creating a Rails-like development environment in .NET

Curtis Mitchell recently posted the slides from a presentation entitled Rails-like ASP.NET Development. Its great to see more people thinking about the tools and technology they use. I found a tool in the slides that I am unfamiliar with called Migrator.NET

Database migrations for .NET. Based on the idea of Rails ActiveRecord Migrations.

Supported Databases

  • MySQL
  • Oracle (not well tested?)
  • PostgreSQL
  • SQLite
  • SQL Server

Supported Modes

 

   1:  using Migrator.Framework;
   2:  using System.Data;
   3:   
   4:  namespace DBMigration
   5:  {
   6:          [Migration(20080401110402)]
   7:          public class CreateUserTable_001 : Migration
   8:          {
   9:                  public void Up()
  10:                  {
  11:                          Database.CreateTable("User",
  12:                                  new Column("UserId", DbType.Int32, ColumnProperties.PrimaryKeyWithIdentity),
  13:                                  new Column("Username", DbType.AnsiString, 25)
  14:                                  );
  15:                  }
  16:   
  17:                  public void Down()
  18:                  {
  19:                          Database.RemoveTable("User");
  20:                  }
  21:          }
  22:  }

Tags: ,

Thursday, June 4th, 2009 ASP.NET 2 Comments

Toolset 2009

Most of my work so far this year has been with one client. This client was a Java shop for quite some time and is pretty green to Microsoft. Also, they don’t seem to ever have had real success with building enterprise class systems. That’s not to say that they haven’t wrote very large and very complex systems. They have done it all with either the bare minimum in tooling or a incorrect implementation of the tooling.

In fact; one of their primary reasons for moving to .NET was to perform a tooling reset. They decided it was too hard to use technology like OR/M, DI, Messaging, and MVC. The figured that (straight from the horse mouth) “Webforms, ADO.NET and SQL” is all we need. I don’t even understand that statement…anyway…back to the tools

Of course I believe this is all based on the improper use of technology. As they say “Any tool can become a weapon if held properly”. unfortunately for me and future developers with this client. The technology that was so frond upon is the tool that….um…well…never mind.

All I am trying to say is that I’ve been pretty tied into some specific Microsoft technology most of the year. Most of the tools on this list had to pass through a standards committee meeting and some are still under the radar…Ok on with the tools!

Visual Studio 2008 (2005, Visual Basic, Dreamweaver)

Thankfully most of my work is new development so I spend a bulk of my time in Visual Studio 2008. Unfortunately is not TFS so my task tracking is handled outside….if at all. Also there are no productivity plug-ins available, I even asked if I could install my own…so no ReShaper or Visual SVN

ASP.NET 3.5 SP1 VB.NET

With most of my work new development I do get to keep up with the .NET version. I am REALLY looking forward to .NET 4 (its just 4 right?…I heard someone from MS flies out and you get your hand slapped if you call it 4.0)

ASP.NET MVC

Yeah! what more can I say.

ASP.NET MVC Futures

This one has not passed through the development standards committee yet but since I also sit on the committee I don’t think it will be much of a fight. Really I only use it for Html.RenderAction

WCF

The tooling is rough but the technology is solid. I am really happy with WCF and hope it infects my clients….but I feel that will stick with asmx for a few more YEARS….

EF

I am just not ready to fight for Nhibernate just yet…I have a new project starting around the 20th, as with every new project I try to push through one new technology. I think this one will finally get a OR/M.

I do like where MS is going with EF and look forward to EF 4, isn’t that what its called in .NET 4.0?, but as much as I work with EF 1 ….man its rough. I’ve often considered using Linq2Sql and building on top ala Rob Conery’s MVC Storefront.

AutoMapper

A convention-based object-object mapper.

AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.

iTextSharp

iTextSharp is a port of the iText, a free Java-Pdf library.

Unity

The Unity Application Block (Unity) is a lightweight extensible dependency injection container with support for constructor, property, and method call injection.

MSTest (unit testing)

Still using the default unit testing framework. Right now I am really focused on getting more developers to write tests…anything…please. Really; there are no tests. Functional testing by non-technical people is NOT testing. Crap…I feel another post coming on…

LINQPad

I am a big fan of LINQ!

LINQPad lets you interactively query SQL databases in a modern query language: LINQ.  Kiss goodbye to SQL Management Studio!

LINQPad supports everything in C# 3.0 and Framework 3.5:

  • LINQ to Objects
  • LINQ to SQL
  • Entity Framework
  • LINQ to XML
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.

It should be noted that I am pretty new to spark and I am testing it in some personal projects to see if its worth bringing into a client. BUT the client has a strict VB only stance…so my testing will not only be standard spark stuff but doing so in a VB.NET MVC project….check out the videos.

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.

I am a JavaScript nut…primarrly jQuery and Dojo…really happy to see it in MVC because it was denied by my largest client until it started coming out of File->New Project…..Thanks Microsoft

jQuery Facebox w/ homegrown iframe support

Facebox is a jQuery-based, Facebook-style lightbox which can display images, divs, or entire remote pages. It’s simple to use and easy on the eyes.

Bringing in modals was a lot of work; demos, meetings, documents, etc….we went with thickbox….I am using facebox with support for iframe content.

CruiseControl.NET

CruiseControl.NET is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework. Again; under the radar…I have a ccnet server running on my desktop…

FxCop

FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements.

SVN

Subversion (SVN) is a version control system initiated in 2000 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS).

BUT…its 1.3.2….and it has pretty limited support for merges…..ugh…I think you get the picture by now….

WebSVN

WebSVN offers a view onto your subversion repositories that’s been designed to reflect the Subversion methodology. You can view the log of any file or directory and see a list of all the files changed, added or deleted in any given revision. You can also view the differences between two versions of a file so as to see exactly what was changed in a particular revision.

WebSVN offers the following features:

  • Easy to use interface
  • Customisable templating system
  • Colourisation of file listings
  • Blame view
  • Log message searching
  • RSS feed support
  • and more…

And best of all….something about radar…

Feedreader

I use feedreader to monitor the RSS feeds from WebSVN. This way I know what is going on with my teams projects and  other teams projects which my programs are dependant

SourceMonitor

SourceMonitor lets you see inside your software source code to find out how much code you have and to identify the relative complexity of your modules. For example, you can use SourceMonitor to identify the code that is most likely to contain defects and thus warrants formal review

  • Collects metrics in a fast, single pass through source files.
  • Measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML.
  • Includes method and function level metrics for C++, C, C#, VB.NET, Java, and Delphi.
  • Saves metrics in checkpoints for comparison during software development projects.
  • Displays and prints metrics in tables and charts.
  • Operates within a standard Windows GUI or inside your scripts using XML command files.
  • Exports metrics to XML or CSV (comma-separated-value) files for further processing with other tools.

Conclusion

I am one stealthy developer…you would think that since I am on the committee that defines developer standards most of these items would be known, understood, or used…..or maybe you think I’m not demoing, teaching, preaching, or begging…well if you think that you don’t know me :)

I am shouting, arguing, and fighting…..ugh…

Tags: , , , , , , , , , , , , , , , ,

A somewhat less biases comparison of MVP and MVC

What is it called?

First off; what are we calling “Classic ASP.NET Development using Webforms and the MVP Pattern” today? I’d like to suggest we stick with a discussion of the patterns and the surrounding technology.

Component based development using the MVP pattern…or MVP for short :)

and

Non-Component based development using the MVC pattern…or MVC for short :)

And I am aware that there are companies working on MVC components/html helpers…so what else are we going to call it? Then again you might be write…what % of “Webforms” developers are using the MVP pattern? 5%?…hmmm…anyway I am sticking with MVC and MVP until I read something better on stackoverflow.com

Don’t be such an ass

Here is the document that I presented to a client when they asked for…well a comparison of “Classic ASP.NET Development using Webforms” and “MVC”

Introduction

In the .NET world the MVC pattern is relatively new but it has been the staple development architecture for Java and Ruby for over a decade. Most of the current the debate between what technology is “better” is argued from a developer’s point of view. While the technical underpinnings of a technology can often translate to the projects success; I feel that both WebForms and MVC are mature enough that most projects will do fine with either.

 

ASP.NET WebForms

Through the abstraction of HTML, CSS, and JavaScript; ASP.NET WebForms attempts to recreate the experience of developing a desktop application. The entire HTTP protocol is successfully abstracted away and developers are present with a faux statefulness that mimics desktop applications. Development teams are able to use a WYSIWIG style of development.

 

ASP.NET MVC

Out of the box ASP.NET MVC forces developers to understand HTML, CSS, and JavaScript. There is little to no abstraction which can be a double edged sword. On one hand your development team has access to the raw power of the markup & languages that make up the web. On the other; if your development team is not experienced with HTML, CSS, and JavaScript there might be a learning curve.

 

Decision Matrix

Number

Topic

ASP WebForms

ASP.NET MVC

1

Size, Extensibility, Maintainability

Your project is small and your team is not experienced with MVC

Your project is large (experience with MVC not required)

2

3rd Party Components

Your project requires many specific 3rd party vendor components

Your project is not bound to 3rd party vendor components (The UI can still be very rich)

3

Open Source

Your project team is not comfortable with open-source libraries

Your project team is comfortable with open-source libraries (especially jQuery)

4

Extensibility, Maintainability

Your customers requirements will not change during development

Your customers requirements may change during development

5

Extensibility, Maintainability

Your project will never be "extended" or have a feature "added"

Your project maybe be "extended" or have features "added"

6

Testability

Unit testing is not required for this project

Unit testing is required for this project

7

Extensibility, Maintainability

 

Your project is limited in maintenance hours

8

Compliance

There is little to no concern with regard to HTML compliance

HTML markup compliance (compliance, screen readers, etc)

 

Notes

  1. The convention built into the MVC framework helps enforce a separation of concerns design pattern what helps developers built applications that are inherently more extensible and maintainable.

  2. If your project/company has an existing large investment in 3rd party components you should consider sticking with whatever framework the components are developed for (Webforms or MVC)

  3. component suites are available for both frameworks but many developers have found that jQuery, and to a less extent other open source frameworks, is a better solution for building rich UI

  4. The convention built into the MVC framework helps enforce a separation of concerns design pattern what helps developers built applications that are inherently loosely coupled.

  5. See note #4

  6. ….

  7. ….

  8. ….

 

 

 

Tags: , , ,

Wednesday, May 20th, 2009 ASP.NET, WebForms, mvc 5 Comments

Dimecasts.net automapper demo

I did a short demo of automapper for dimecasts.net. Take a look what do you think?

Ha! Dimecasts.net is my phonebook! :)

Ha!

Tuesday, May 19th, 2009 ASP.NET, AutoMapper, Microsoft, Video, WCF No Comments

A completely biased comparison of ASP.NET MVC and Webforms

I have to admit I am total bias towards MVC but hear me out. I have yet to work in an organization that implements an OOP or even MVP when using WebForms. It’s all been directly bound controls to data readers/sets/tables. No object model, no business object layer, page_load is used and abused, etc. It can’t be stated enough that MVC will not save a project from the bullshit code that is forms over data crap but at least there is hope in the form of a tiny amount of guidance from Microsoft. </rant>

Introduction

In the .NET world the MVC pattern is relatively new but it has been the staple development architecture for Java and Ruby for over a decade. Most of the current the debate between what technology is “better” is argued from a developer’s point of view. While the technical underpinnings of a technology can often translate to the projects success; I feel that both WebForms and MVC are mature enough that most projects will do fine with either.

The technical debate does nothing for those who are trying to persuade their organization to consider ASP.NET MVC. What I am trying to present here is a list of decision points an organization can use when deciding on MVC vs. WebForms.

ASP.NET WebForms

Through the abstraction of HTML, CSS, and JavaScript; ASP.NET WebForms attempts to recreate the experience of developing a desktop application. The entire HTTP protocol is successfully abstracted away and developers are present with a faux statefulness that mimics desktop applications. Development teams are able to use a WYSIWIG style of development.

ASP.NET MVC

Out of the box ASP.NET MVC forces developers to understand HTML, CSS, and JavaScript. There is little to no abstraction which can be a double edged sword. On one hand your development team has access to the raw power of the markup & languages that make up the web. On the other; if your development team is not experienced with HTML, CSS, and JavaScript there might be a learning curve.

Decision Matrix

ASP WebForms

ASP.NET MVC

Your project is small and your team is not experienced with MVC

Your project is large (experience with MVC not required)

Your project requires many specific 3rd party vendor components

Your project is not bound to 3rd party vendor components (The UI can still be very rich)

Your project team is not comfortable with open-source libraries (expecially jQuery)

Your project team is comfortable with open-source libraries (especially jQuery)

Your customers requirements, possibly by contract, will not change during development

Your customers requirements may change during development

Your project will never be "extended" or have a feature "added"

Your project maybe be "extended" or have features "added"

 

Your project is mission critical and deserves the comfort provided by unit testing

 

Your project is limited in maintenance hours

 

Your project cares about HTML markup compliance

Conclusion

I think that most projects will be able to succeed using either technology. The question is simply how much pain will you cause your developers? Will you stick with web forms and create an endless maintenance cycle? We know how much developers love maintenance programming. Or will you force them out of their comfort zone and make them learn something new for the sake of your project?

Tags: , , , , ,

Friday, May 15th, 2009 ASP.NET, ASP.NET MVC, Microsoft, jQuery, mvc 2 Comments

Dojo and ASP.NET AJAX Compatibility

As part of developing a project I created a Cross-Domain Proxy to consume the payment service. My Cross-Domain Proxy, Payment.asmx, is exposed via the JavaScript end point. Any ASP.NET web service can open the JavaScript endpoint by uncommenting line #7 in the asmx file.

image

 

Once the ScriptService line is uncommented you can test that your service is exposing the JavaScript endpoint by calling a URL similar to:

   1:  ~/WebService.asmx/JS

In the master page I pull the service in.

   1:  <asp:ScriptManager ID="ocScriptManager" runat="server">
   2:      <Services>
   3:            <asp:ServiceReference Path="~/WebServices/Payment.asmx" />
   4:       </Services>
   5:  </asp:ScriptManager>

At this point everything works. I can write JavaScript to call back to the web service methods as such:

   1:  WebService.AddItem('item', CallBackFunction, FailFunction);
   2:   
   3:  CallBackFunction = function(){
   4:       alert('everything worked');
   5:  }

Now, I pull dojo into this project.

   1:  <script type="text/javascript">djConfig = { parseOnLoad: false, usePlainJson: true };</script>
   2:  <script type="text/javascript" src="http://dojopath/dojo.js"></script>

Here is where we start to run into problems. Due to, what I believe, is having both JavaScript APIs in the same project.

image

If we change the order of API loading we can get a, somewhat, clearer error message.

image

Now looking at line 1175 we see:

image

Conclusion:

I believe that I have exhausted my troubleshooting efforts. although I am not sure if this is enough information to validate the existence of a bug I opened a ticket with Dojo. Then again, I am not sure who can or should fix it.

http://trac.dojotoolkit.org/ticket/7353

I blogged about this once before.

http://eric.polerecky.com/archives/dijitformvalidationtextbox-and-aspnet-ajax/

Workaround:

In my project I use dojo.xhr to make calls back to the server.

Friday, February 13th, 2009 ASP.NET, ArcGIS, Dojo, JavaScript, development No Comments

My take on Microsoft shipping jQuery

First, if you have not heard, Microsoft will be shipping jQuery as part of visual studio. And if the swiftness that the .NET team moves I am sure we can see it in a the next SP. Update: Just re-read the article…The jQuery intellisense annotation support will be available as a free web-download in a few weeks…w00t.

jQuery

jQuery is great, its selector engine is by far the simplest and (I think) most powerful component. But, when using jQuery I always seem to be looking for pluggins…widgets…etc.

Microsoft’s Challenge

Even though my current shop uses dojo, which I love too!, I am truly excited by this move. But integrated jQuery is the potential to become another underutilized component in the .NET toolbox. intellisense is great but most DNDD can’t type a lick of JS. Microsoft is going to have to wrap some widgets around this powerful engine.

 

DNDD: Drag and Drop Developer. Yes it does have a negative condensation.

Monday, September 29th, 2008 ASP.NET, jQuery No Comments

Visual Studio, Wizards, Project Templates and Unsigned DLLS

If, after you followed all the steps at http://msdn.microsoft.com/en-us/library/ms185301(VS.80).aspx you are getting an error about unsigned DLLs…try adding the DLL to the bin folder of your project…

Just re-code the wizard in C#…I guess there is a reason all the examples are in C#…

Monday, September 22nd, 2008 ASP.NET, Fail, Project Templates No Comments

MembershipUser to DataTable

Anyone know if there is a cleaner way to do this?

 

   1:  Private Function MembershipUser_To_DataTable(ByVal vMembershipUser As MembershipUser) As DataTable
   2:          Dim mDataTable As New DataTable
   3:          mDataTable.Columns.Add("Email")
   4:          mDataTable.Columns.Add("PasswordQuestion")
   5:          mDataTable.Columns.Add("Comment")
   6:          mDataTable.Columns.Add("IsApproved")
   7:          mDataTable.Columns.Add("CreateDate")
   8:          mDataTable.Columns.Add("LastLoginDate")
   9:          mDataTable.Columns.Add("LastActivityDate")
  10:          mDataTable.Columns.Add("LastPasswordChangedDate")
  11:          mDataTable.Columns.Add("UserId")
  12:          mDataTable.Columns.Add("IsLockedOut")
  13:          mDataTable.Columns.Add("LastLockoutDate")
  14:          mDataTable.Rows.Add(vMembershipUser)
  15:          Return mDataTable
  16:      End Function

Monday, September 15th, 2008 ASP.NET, Membership No Comments

Search