CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Darrell Norton's Blog [MVP]

Fill in description here...

January 2004 - Posts

  • Going AWOL

    I'll probably be quiet for a week or so.  I'm having surgery on my ankle after breaking it snowboarding.

    Happy bloggin'!

  • Review of Applying UML and Patterns by Craig Larman

    The subtitle to this book is “An Introduction to Object-Oriented Analysis and Design and the Unified Process”, and it is indeed a book about object-oriented analysis and design.  Applying UML and Patterns uses the unified process (UP) as the iterative process within which OOA/D is introduced, and contains a single case study which is elaborated on throughout the book.

    Applying UML and Patterns is not about learning the UML.  It’s about teaching you to “think” in objects with operations and properties.  It helps to put into perspective what UML and patterns are being applied at which stages in the software development process.  Even if you already know UML, this context alone is worth the book’s price.  After reading this book you will have a different opinion on the importance and use of most of the UML diagrams.  Many times Craig delves into the “whys” of something, helping you understand the reason for each element from a business point of view.

    One of the most valuable parts of the book are detailed examples of how to use each of the basic (GRASP) patterns along with some popular Gang of Four (GOF) patterns to create solid software designs.  Although it seems tedious to consider all the angles Larman uses, it brings to light many different factors to consider while designing software.

    Check out more book reviews at the WeProgram.NET Book Review page.

  • Tips and Best Practices for NUnitAsp testing

    After using NUnitAsp to do lots of testing over the past several weeks, I've learned a few tips that I would like to pass on.  These are not “how-to code NUnitAsp“ but more of “how to keep your hair with NUnitAsp.“

    1. Test for the URL of the page you expect first.  True to Test-Driven Development, make sure that the browser’s current URL local path is what you expect (i.e., /myApplication/startPage.aspx).  Doing so will save you a lot of headache when trying to figure out why a certain control is not visible.  This leads us to the next guideline…
    2. Prefer tests of the visibility of a control when true.  Successful tests for false visibility can be misleading.  For example, if you misspell the control’s rendered name, a test for visibility = false will still pass.  Tests for false visibility are useful when used in conjunction with tests for true visibility, i.e. to ensure that certain controls are shown while others are not.
    3. Make sure the web project you are testing is working before attempting to test with NUnitAsp.  You can make sure it works by navigating to it at http://localhost/AppName (or wherever you are testing against it, it does not have to be localhost).
    4. Be prepared to wait.  NUnitAsp tests are not fast.  The bigger the project, the longer the initialization time.  You can speed things up by opening the application in a web browser, which forces .NET to JIT compile all the class files in that directory.  But that only works until the next build.
    5. The more controls you test, the more brittle your tests are.  Try to test only those controls that are the centerpiece of the page.  If you start writing visibility asserts for every image or hyperlink, when the page changes those tests will break.  Keep the focus on the important things, the inputs and events (i.e., textboxes and buttons).  A useful develop-for-testing tip is to use labels to display text instead of <% =databoundText %>.  Then the NUnitAsp tests can test to see if the label is there, regardless of the text.
    6. Overload the ImageButtonTester.Click(x, y) event.  When testing an ImageButton with an ImageButtonTester, the Click event takes two integers as the x and y coordinates of the ImageButton click.  Unless the button does different things based on the x and/or y values, you are just going to be writing a lot of meaningless myButton.Click(0,0) code.  Add in an override, and you can just write myButton.Click(). - This has since been implemented in NUnitAsp
    Posted Jan 22 2004, 09:34 AM by darrell with 11 comment(s)
    Filed under:
  • Congratulations to James Avery - ASP.NET MVP

    I just found out my buddy James Avery is an ASP.NET MVP.  He is also keeping a list of the newly-named MVPs with links to their blogs.

    Congrats James!

  • Review of UML Distilled by Martin Fowler

    UML Distilled is an introduction to the UML.  It boils down the huge amount of documentation surrounding the UML into a small (160 page) subset of the UML that software developers need to know for normal software construction.  Martin Fowler is not too keen on strict adherence to the UML, but instead seeks to use UML to communicate parts of a software program or problem domain (UML as a sketch).

    The book is a quick and easy read.  And although it is geared to software developers, managers will not be overwhelmed by technical jargon.  It clearly covers the most highly used parts of the UML with lots of diagrams and illustrations of use.  Areas of the UML that are not used as much get much shorter treatment.  Sprinkled throughout the book are tips from the field and non-normative diagrams (non-conventional usage) that Fowler believes communicate more clearly the intent behind the software.  If you are a stickler for the rules, ignore these pragmatic tidbits of information.

    If you are looking for a general introduction or light reference to the UML, this is the book.  If your development team or company does not already have UML standards or conventions in place and you need a starting point, this is the book.  If you are looking to pick up some tips on how to model more effectively with the UML, this is the book.

    Check out more book reviews at the WeProgram.NET Book Review page.

  • VSNUnit - NUnit integration with Visual Studio .NET

    I finally had a chance to check out VSNUnit.  It seems to run pretty well.  I don’t get as many errors as the TestRunner add-in, though neither program is perfect.  I don’t know which one I like more yet; I guess more use is required.

    Here’s the screenshot from TheServerSide.NET article:

  • WeProgram.NET begins membership drive!

    WeProgram.NET had its inaugural meeting in June 2003.  Since then membership has grown rapidly, with members attending from throughout Hampton Roads.  We usually meet on the first Tuesday of every month.  Currently ESI in Newport News provides the meeting facilities (directions and meeting times).  To learn more about our user group, check out our FAQ.

    Right now we are beginning a membership drive!  From now through the April meeting, we’re concentrating on getting new members to come to our meetings.  There’s no obligation, no fees, nothing but .NET presentations and code.  We’ve lined up some top-notch presenters covering topics such as Test Driven Development with .NET, Refactoring, and more, including some hands-on programming exercises!

    As an added incentive, during our membership drive, everyone who refers someone that attends a WeProgram.NET meeting will be entered into a drawing for a FREE pass to Wintellect’s Devscovery conference in Washington, DC.  That’s a $900 value! 

    Haven’t attended before?  Refer yourself!  Just show up and we’ll put your name “in the hat.”  Grand prize awarded at the April meeting.

    Benefits of WeProgram.NET

    • Access to great speakers, presentations, and code every month.
    • Free book giveaways every month just for showing up.
    • Free food and drinks every month.
    • Network with your peers from all around the community.

    Upcoming Speaker Schedule

    Feb 10 and Mar 9

    Thanks to CapTech Ventures, WeProgram.NET is offering the hands-on workshop “Test Driven Development: Building .NET Muscle” by Steve Metsker.  The workshop was a big hit at OOPSLA, an annual conference that provides tutorials, papers, presentations, and discussions of Object Oriented practices.  Normally a 3+ hour tutorial, the presentation will be split across 2 meetings to allow for maximum interaction and hands-on learning.  Bring your laptop and be ready to code!

    April 6

    Wintellect will be sponsoring some nationally-renowned .NET experts at our April meeting.  Who will it be?  You’ll have to show up to find out!  We will also announce the winner of the free pass to Devscovery.

    May 4

    Frank Grimberg will be presenting in May.  Frank, principal consultant at Prosoft Systems Int’l, specializes in ASP.Net development methodologies.  He has 18 years of development experience, over 100 successful custom software implementations, and is an accomplished speaker.

    June

    In June we will be having an INETA speaker!

    Thanks to Our Sponsors

       www.OptimizeIT.net   It's important to thank our web hosting sponsor, OptimizeIT.net, for hosting the WeProgram.Net website. OptimizeIT also buys snacks and provides occasional speakers.
    ESI (Electronic Systems) provides our meeting facility. 
    INETA is a non-profit, independent organization, that supports all user groups interested in the Microsoft .Net platform. INETA is run by a board of user group leaders and supported by Microsoft Corporation and other sponsors. INETA helps WeProgram.Net stay connected with the broader .Net community and offers specials to WeProgram.Net members.
    O'Reilly sponsors WeProgram.Net by providing book donations and review copies of new O'Reilly titles, access to authors, and 20% discounts on conferences and products from O'Reilly.
    SAMS sponsors WeProgram.Net by providing book donations and review copies of new SAMS titles.
    Wintellect is a premier training, consulting, and debugging firm. Wintellect sponsors WeProgram.Net in a variety of ways, including Wintellectual speakers, book give-aways, and more.
    Addison-Wesley sponsors WeProgram.Net by donating books for us to review and give away.
    CapTech Ventures, a regional IT consulting firm, sponsors WeProgram.Net by providing speakers and snacks.

  • The rising importance of SLAs

    As Jim Meeker is finding out, Service Level Agreements are increasingly important in an age of web services and service-oriented architectures.

    Here is an excellent summary of Service Level Agreements.  It includes an overview, checklist, case study, buzzword definitions, Q&A with an IT executive, applicable metrics, and more.  Well worth the 10 minutes (or less) it will take you to read it.

  • New Crystal Reports ad?

    With the recent release of everybody's favorite reporting software, Crystal Reports, a secret informer gave me unsubstantiated details of a possible ad campaign for the new version.  Here it is:

    I'm just not sure how well this ad will sell software.  I don't know, maybe it's just me.

  • Per-Assembly Configuration Files ported to VB

    Mike Woodring at DevelopMentor created an excellent code sample on Per-Assembly Configuration Files.  The sample contains a class called AssemblySettings that allows you to use per-assembly configuration files with appSettings-like configuration elements.  The original code is in C#, however I needed to port it to VB.NET.  For anyone else that needs it, here it is. 

     

    This file, AssemblySettings.vb, replaces the AssemblySettings.cs file in the original project (you would also need to change the project type to a VB class library instead of a C# one).  Or just copy-paste this into a project and use it.

     

     

    ' Original code and credits

    ' Mike Woodring

    ' http://staff.develop.com/woodring

    '

    ' VB.NET port by Darrell Norton

    ' http://dotnetjunkies.com/weblog/darrell.norton/

    '

    Imports System

    Imports System.Reflection

    Imports System.Collections

    Imports System.Xml

    Imports System.Configuration

     

    ' AssemblySettings usage:

    '

    ' If you know the keys you're after, the following is probably

    ' the most convenient:

    '

    '   C# code

    '      AssemblySettings settings = new AssemblySettings();

    '      string someSetting1 = settings["someKey1"];

    '      string someSetting2 = settings["someKey2"];

    '   VB.NET code

    '       Dim settings As AssemblySettings = New AssemblySettings()

    '       Dim someSetting1 As String = settings("someKey1")

    '       Dim someSetting2 As String = settings("someKey2")

    '

    '

    ' If you want to enumerate over the settings (or just as an

    ' alternative approach), you can do this too:

    '

    '   C# code

    '      IDictionary settings = AssemblySettings.GetConfig();

    '      foreach( DictionaryEntry entry in settings )

    '      {

    '          // Use entry.Key or entry.Value as desired...

    '      }

    '   VB.NET Code

    '       Dim settings As IDictionary = AssemblySettings.GetConfig()

    '       Dim entry As DictionaryEntry

    '       For Each entry In  settings

    '           ' Use entry.Key or entry.Value as desired...

    '       Next entry

    '

    '

    ' In either of the above two scenarios, the calling assembly

    ' (the one that called the constructor or GetConfig) is used

    ' to determine what file to parse and what the name of the

    ' settings collection element is.  For example, if the calling

    ' assembly is c:\foo\bar\TestLib.dll, then the configuration file

    ' that's parsed is c:\foo\bar\TestLib.dll.config, and the

    ' configuration section that's parsed must be named <assemblySettings>.

    '

    ' To retrieve the configuration information for an arbitrary assembly,

    ' use the overloaded constructor or GetConfig method that takes an

    ' Assembly reference as input.

    '

    ' If your assembly is being automatically downloaded from a web

    ' site by an "href-exe" (an application that's run directly from a link

    ' on a web page), then the enclosed web.config shows the mechanism

    ' for allowing the AssemblySettings library to download the

    ' configuration files you're using for your assemblies (while not

    ' allowing web.config itself to be downloaded).

    '

    ' If the assembly you are trying to use this with is installed in, and loaded

    ' from, the GAC then you'll need to place the config file in the GAC directory where

    ' the assembly is installed.  On the first release of the CLR, this directory is

    ' <windir>\assembly\gac\libName\verNum__pubKeyToken]]>.  For example,

    ' the assembly "SomeLib, Version=1.2.3.4, Culture=neutral, PublicKeyToken=abcd1234"

    ' would be installed to the c:\winnt\assembly\gac\SomeLib\1.2.3.4__abcd1234 diretory

    ' (assuming the OS is installed in c:\winnt).  For future versions of the CLR, this

    ' directory scheme may change, so you'll need to check the <code>CodeBase</code> property

    ' of a GAC-loaded assembly in the debugger to determine the correct directory location.

     

    Public Class AssemblySettings

     

        Private settings As IDictionary

     

        Public Sub New()

            MyClass.New([Assembly].GetCallingAssembly())

        End Sub

     

        Public Sub New(ByVal asm As [Assembly])

            settings = GetConfig(asm)

        End Sub

     

        Default Public ReadOnly Property Item(ByVal key As String) As String

            Get

                Dim settingValue As String = Nothing

     

                If Not (settings Is Nothing) Then

                    settingValue = settings(key)

                End If

     

                If (settingValue Is Nothing) Then

                    Return ""

                Else

                    Return settingValue

                End If

            End Get

        End Property

     

        Public Overloads Shared Function GetConfig() As IDictionary

            Return GetConfig([Assembly].GetCallingAssembly())

        End Function

     

        Public Overloads Shared Function GetConfig(ByVal asm As [Assembly]) As IDictionary

            ' Open and parse configuration file for specified

            ' assembly, returning collection to caller for future

            ' use outside of this class.

            '

            Try

                Dim cfgFile As String = asm.CodeBase + ".config"

                Const nodeName As String = "assemblySettings"

     

                Dim doc As New XmlDocument()

                doc.Load(New XmlTextReader(cfgFile))

     

                Dim nodes As XmlNodeList = doc.GetElementsByTagName(nodeName)

     

                Dim node As XmlNode

                For Each node In nodes

                    If node.LocalName = nodeName Then

                        Dim handler As New DictionarySectionHandler()

                        Return CType(handler.Create(Nothing, Nothing, node), IDictionary)

                    End If

                Next node

            Catch

            End Try

     

            Return Nothing

        End Function

    End Class

  • ABCUpload.NET file upload utility - free for a link

    Scott Galloway commented in response to Grant Killian's post on httpRuntime and File Upload Limits highlighting an excellent deal.

    WebSupergoo is offering an incredible deal on ABCUpload.NET a massive (GB-range) fully managed code ASP.NET file upload utility.  The deal is you get a license for FREE (as in beer) if you link to them from your home page.  Normal cost is $249.  Get the full details on this type of license.

    Permission marketing and Google-boosting combine to deliver free software!

  • Even good detergent can't get the SPOT out

    Well, it looks like my Tech Predictions for 2004 are already starting to come true!

    ZDNet reporter David Coursey doesn't think too highly of Microsoft's SPOT.  I applaud Microsoft's efforts at something totally new and unprecedented, but it is just not ready yet.  With as much focus as Microsoft usually puts on developers, developers, developers, where are the tools?  Why is nobody building for it?

  • XP 'Bill of Rights' says customers don't have to pay to change their mind?

    The .Avery Blog pointed me to an article on Builder.com called Extreme Programming 'Bill of Rights'.  Since I am interested in software development methodologies such as Scrum, XP, and Lean Software Development, I read it.

    While it is pretty good overall, this one quote in the Customer Rights section is hilarious:

    “The customer has the right to change his/her mind without paying exorbitant costs.”

    So, if the customer were to change their mind after 6 months of building a web application that they really wanted a windows client application, they should not pay exorbitant costs?  The statement is comical in its naivety.

  • Eric Sink follows up on the popular 'MMM' article

    Eric Sink posted a follow-up to his MSDN article Make More Mistakes.  In it he refutes the popular notion that his own personal wealth helped SourceGear through the many mistakes he made.  The notable quote:

    “Regardless of the scale of your business, the central point of my article still applies:  "Make all the non-fatal mistakes that you can -- don't make any of the fatal ones."  Only you can figure out what might be "fatal" for your particular situation.  Smaller firms should take smaller risks.  Bigger firms can take much bigger risks without placing the survival of the company in jeopardy. 

    Either way, choosing to take no risks at all is an excellent algorithm for avoiding success.”

    In case you are wondering why I posted this, it’s all about risk management.  The same basic principles apply regardless of whether it’s a project or a small business.

  • Stress testing web applications

    As part of a recent engagement, I had to setup a stress test (load test) suite on several ASP.NET web applications.  There are a couple of tools that can help. 

    Application Center Test (ACT) that comes with Visual Studio.NET is easy to use and integrates right into the development process.  But it does not allow you to use multiple clients to simulate load.  So you will always be limited by your current machine’s horsepower in creating a high simulated load. I saw it posted online in a newsgroup from a Microsoft employee that ACT is basically for a developer to do rough performance testing on his/her own development machine to avoid any serious performance issues at the time of code creation.  ACT has a big brother, Application Center 2000, but it is a server product, and so is way too expensive to look at unless already in use.

    The Web Application Stress tool (WAS) is available as part of the Microsoft Windows 2000 resource kit, yes it works on Windows Server 2003, or as a standalone download.  It has several nifty features.  First, you can create tests by importing an IIS log file, although I did not try this with an IIS6 log file since I was testing a Win2k system.  Say your web site handles a spike in demand poorly, with lots of dropped connections.  So you beef up the server hardware and maybe optimize some code algorithms.  Then you can feed the IIS log files into WAS and it will try to recreate the same load so you can see whether you improved things or not.  WAS also allows you to use multiple client computers to simulate a higher load (which is why I used it this time versus ACT).  And the test data is stored in an Access database.  It will allow you to specify hundreds of users with passwords, so testing authenticated sites (forms or Windows authentication) are possible.

    There are some drawbacks that I ran into, however.  Testing sites with cookies is annoying at best.  And when testing SSL pages, you have to record against a non-SSL page and go back and manually turn on SSL support in the generated test scripts after the test recording is done.  Also, when enlisting multiple clients, they should all be about the same performance-wise.  WAS is not smart enough to configure the test data according to the computer’s horsepower.

    More WAS links:

More Posts Next page »