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

Darrell Norton's Blog [MVP]

Fill in description here...

October 2004 - Posts

  • FxCop 1.312 Released!

    Download

    Major features of this release
    ======================
    -Simplification of report xml.
    -New Fix Categories: Each message is marked to indicate if the suggested fix will constitute a breaking change for previously shipped code.
    -User Interface Improvements: windowing behavior has been made more consistent
    -Auto Update: Sign up to get notified when a new version of FxCop is available.

    New Rules
    ========
    Design
    -Avoid excessive parameters on generic types
    -Collections should implement generic interface
    -Do not declare static members on generic types
    -Do not expose generic lists
    -Do not nest generic types in member signatures
    -Enums should have zero value
    -Generic methods should provide type parameter
    -Members should not expose certain concrete types
    -Types should not extend certain base types
    -Use generic event handler instances
    -Use generics where appropriate

    Interoperability
    -Avoid overloads in ComVisible Interfaces
    -Call GetLastError immediately after PInvoke
    -Com visible base types should be ComVisible
    -Mobility
    -Do not use idle process priority
    -Do not use times that prevent power state changes
    -Naming
    -Compound words should be cased correctly
    -Do not name enum values ‘Reserved’
    -Resource string compound words should be cased correctly

    Performance
    -Avoid calls that box value types
    -Avoid costly calls where possible
    -Avoid unnecessary string creation
    -Avoid unused parameters
    -Do not cast unnecessarily
    -Do not ignore method results
    -Do not initialize unnecessarily
    -Remove unused locals
    -Use literals where appropriate

    Portability
    -Avoid testing for floating point equality
    -PInvoke declarations should be portable
    -Security
    -Catch non-CLSCompliant exceptions in general handlers
    -Review sql queries for security vulnerabilities

    Usage
    -Call base class methods on ISerializable types
    -Do not dispose objects multiple times
    -Do not raise reserved exception types
    -Implement ISerializable correctly
    -Implement serialization methods correctly
    -Literals should be spellect correctly
    -Mark all non-serializable fields
    -Provide deserialization methods for optional fields
    -Rethrow to preserve stack details
    -Review Boolean assignment evaluations
    -Use managed equivalents of win32 api

    Migrating Custom Rules
    =================
    Please see the readme at http://www.gotdotnet.com/team/fxcop/Misc/gotdotnetstyle.aspx?url=1.312_readme.mht for more details on how to migrate custom rules.

  • 828,000 Windows users can't be wrong, can they?

    I was skeptical of the “Windows Genuine Advantage” program, seeing no real, er, advantage. But apparently 828,000 people have visited the site, according to Mary Jo Foley

    And now Microsoft is (finally) offering $390 in free/reduced price software, like Photo Story.

  • What is Indigo's value proposition?

    Benjamin posts an interesting response to Joel Spolsky’s interview on Microsoft-watch. Basically Joel says he’s not interested in Indigo since it is just a “big communications architecture” that makes it easier to build connected systems. Here are my thoughts in response to some of Benjamin’s questions:

    There is already a business imperative that applications communicate. The method they communicate by, however, varies greatly, and the majority of them don’t do it “the SOA way!” The easiest way for applications to be connected is to share the database. Of course, this breaks all the rules in bypassing the security, business rules, etc. that are contained in all the application layers above the data. It works but it’s fragile. And this is where Indigo will come in. It will be easier for me to do the right thing (a la the Pragmatic Programmers).

    I like the goals of Indigo. I believe that frameworks like Indigo should handle the underlying complexity the majority of the time. Every additional layer of abstraction, although dangerous if it is leaky, improves productivity. That way I can worry about autonomous services and not network protocols (for example). At a previous employer the introduction of ASP.NET and the huge gains in productivity over classic ASP allowed for fewer developers to do much more with a better end product. When the users notice this, then you know that the benefits are real. I can imagine the same thing for Indigo.

    Steve Maine also has a good post, calling Indigo the Web Services Kernel.

  • FlashBlock: prevent autoloading of Flash content

    In the comments to my previous post, Scott Galloway noted that advertisements could be the only thing keeping some web sites afloat financially. I noted that I didn’t mind text ads or static images, but animated gifs and Flash ads had to go.

    Well, it doesn’t have to be one or the other. FlashBlock is a Mozilla/Firefox extension that never loads Flash until you tell it to. From the web site:

    Flashblock is an extension for the Mozilla and Firefox browsers that takes a pessimistic approach to dealing with Macromedia Flash content on a webpage and blocks ALL Flash content from loading. It then leaves a placeholder on the page that allows you to click to view the Flash content.

  • Blocking 99%+ ads in Firefox

    I’ve seen some things about blocking ads from web pages, such as the AdBlock extension. AdBlock is good, but I can only block ads after I’ve seen them.

    The best method I’ve seen so far was developed by Neil Jenkins. Just add some code to your userContent.css file, and you’ll get almost no ads. Neil also updates the page every now and then, so if you haven’t checked it recently, go download it again.

  • Review of Managing the Professional Services Firm by David Maister

    I was looking for a good book about how a professional services firm operates. There are tons of lame books for “getting started in consulting” or “your first year as a consultant”, but I wanted something that was more geared toward firms. You know, those companies with more than a couple loosely-connected independent contractors? Fortunately David Maister delivered with Managing the Professional Services Firm.

    The book is a collection of 32 articles that he published from 1982 to 1995 in such respected industry periodicals as American Lawyer, Sloan Management Review, and the Journal of Management Consulting. Since each chapter was previously an article, each one is easily digestible in a single sitting. In the book the articles are arranged in order so that articles within each of the six sections build on one or more articles earlier in that section. The sections cover consulting firm basics, client matters, employee matters, partnership matters, multi-site issues, and asset management. David covers so many topics that are valuable that here I will pick on what I think are the highlights.

    Partners are the key to the professional services firm. Nobody says, “I want to work my way up to be a junior consultant!” Partners are those people, who through experience, hard work, and perseverance have made it to the top of the firm. These are the people that lead exciting projects, bring in work to the firm, and command high bill rates. So a natural focus for the book is measuring partner profitability. Most consultants would agree that, as a profession, we are evaluated primarily on our personal billability, not our overall contribution to the firm (unless you are an independent consultant, and then you ARE the firm!). But who is worth more, a partner who is highly billable and works alone or a partner that keeps six junior consultants working on a project but whose billability is down because of it? So Maister came up with a variation on the DuPont formula that shows three paths to profitability (profits / partners): margin (profits / fees), productivity (fees / staff), and leverage (staff / partners). He also recommends per-project profit measuring. Most firms make 120 percent of their profit on 80 percent of the accounts. The other 20 percent actually lose money! And usually the accounts that lose money are the ones that are seen as “high-profile must win” projects.

    After we understand that, then it is time to find out how to satisfy another of our firm’s three stakeholders, the client. Maister draws the distinction between quality work and quality service. Client satisfaction equals perception minus expectation. If the client perceives service at a certain level, but expected something more, you’re in trouble! Notice that this formula mentions nothing about reality. So managing expectations keeps client satisfaction achievable by preventing a letdown. On the flip side, the client must perceive that your work is valuable and of high-quality. This is a challenge in a time when clients are demanding more and competing firms are willing to compete based on price. You may think you compete based on quality, not quantity, but your clients may see the situation differently.

    Finally we turn our attention to the remaining stakeholder, the firm’s employees. Employees can be seen in terms similar to financial statements (no I’m not dehumanizing consultants, stick with me for a minute) with a balance sheet and an income statement. An employee’s balance sheet is their accumulated inventory of skills and knowledge and client relationships. As we all know, especially in the software industry, skills and knowledge deteriorate at an alarmingly fast rate. So every employee must continually upgrade their current skills and add news ones in a process of continual learning. This process of continuous improvement is the income statement; what new skills or abilities are learned that can be put on my balance sheet. In a similar manner client relationships are based on how deep they are. What is a deep relationship? A deep client relationship is one where the client will give you projects that they don’t know that you can do. Landing a contract is easy if you have prior experience doing something similar, but you are not going to learn much in the process (since you’ve done it before, right?). A client who trusts you will give you projects that will expand your horizons and challenge your abilities. It’s usually harder work and much more stressful, but it is valuable income that builds your assets, resulting in direct improvements to your balance sheet (which makes it easier to get new work, and so on).

    If you work at a consulting company or other professional services firm, you owe it to yourself to read this book. If you are an independent contractor or have started your own consulting company, you owe it to yourself to read most of this book (skipping the partner and multi-site sections). And if you hire consulting firms, this certainly offers a lot of insight into the consulting industry.

  • Does anyone use the Pseudocode Programming Process?

    I’m currently reading Code Complete 2 by Steve McConnell and I just finished Chapter 9. Chapter 9 talks about the Pseudocode Programming Process (PPP) in detail.

    PPP helps you design high-quality routines (methods in .NET). Basically you write what the routine should do and how it will do it in plain English (or your native language). Your comments should not be programming language-specific. Then you further breakdown each line of pseudocode until it would be easier to just code it than break it down further. At this point you turn all the existing pseudocode comments, and write your code. The benefits are supposed to be: earlier detection of flaws, easier and more robust design, fewer errors, and easier code reviews (at the pseudocode level).

    Since I use Test Driven Development pretty heavily, I think I get a lot of these benefits by writing the test code in conjunction with the evolving production code. Sure I’ve had to rewrite methods before, but my methods aren’t that long, so I’m wondering what the value of PPP is.

    My question to you, then, is do you use something similar to PPP while coding? Occasionally or all the time? Does it help you or does it slow you down?

  • Hacknot on test anti-patterns

    Since the project I’m working on is in the later stages, this post about bad testing from Hacknot is particularly timely. I agree with almost all of it, though it is obviously biased toward the development point of view, and the last point he makes, that developers should determine the partial code coverage, is wrong in my opinion.

  • Selecting the search engine in the Firefox search bar

    Ok, this is the last Firefox tip on searching.

    You’ve added smart keywords to your search and added custom search engines to Firefox. Now you’re tired of clicking on the little icon to change the search engine you’re using and you need a keyboard shortcut!

    Press Ctrl + UP arrow or Ctrl + DOWN arrow to cycle through the search engine choices.

  • Determining if a T-SQL variable is in a range of values

    Here’s a neat little T-SQL trick.

    You can use set-based operations on variables. For example, copy this in SQL Server Query Analyzer and running it prints “Vowel” to the output window:

    DECLARE @letter char(1)
    SELECT @letter = 'A'
    IF @letter IN ('A', 'E', 'I', 'O', 'U')
                PRINT 'Vowel'
    ELSE
                PRINT 'Consonant'

    Yes the example is simple, but where I find it useful is with a varchar variable passed into a stored proc called by other stored procs. I need to check for one of 10 values (out of hundreds), and this is a whole lot easier than writing
    IF @letter = ‘A’ OR @letter = ‘E’ etc.

  • Get popup alt attributes in Firefox

    One thing I miss in Firefox is having an image’s alt text appear when you pause your mouse over it. Apparently someone else did too, because there’s a Popup ALT Attributes extension. There is even support for multi-line alt tags by modifying the user.js file.

  • Adding pre-made smart keyword searches

    This tip is a follow-up to Friday’s Firefox tip thanks to Jason Row.

    If you click the Google icon in the search box you will see a list of default search engines that include Amazon, Dictionary.com, eBay, and Yahoo! There is also the option to “Add engines…” which will take you to a page that allows you to add smart keyword searches, similar to the custom one you made in my last post, but these are already made for you! At last count there were almost 700 engines in a variety of topic areas like Arts, Shopping, Programming, and Business, including MSDN and Microsoft Support searches.

  • Adding smart keywords to your online searches

    I end up searching several different web sites frequently, and it’s a pain going to the site first, then entering my search term, and finally looking at the results. Luckily Firefox has a huge shortcut to this. Here’s how:

    1. Go to the page with the search form. For this example, let’s go to the MSDN  home page.
    2. In the “Search MSDN for” box in the upper right, put the mouse over the search box, and right-click. In the menu that pops up, select “Add a keyword for this search…”
    3. The “Add a Bookmark” dialog box will appear. Enter “MSDN home page” in the Name field, and enter your preferred shortcut term in the Keyword field. I’m going to use “msdn”.
    4. You can change the folder the bookmark will be created in if you want. For now accept the default and click “Ok”.
    5. Go to Google’s home page, just so you know Firefox isn’t cheating.
    6. Click in the URL bar (or press Alt+D), and type “msdn asp.net 2” without the quotes.

    You should see the MSDN/Microsoft search page with the first 10 results for “ASP.NET 2”. Now go add more smart keywords!

    Download Firefox now!

  • New blog category: Firefox Tips

    By request, I've added a Firefox Tips category. It will contain, amazingly enough, tips and tricks for using Firefox.
More Posts