dotnet, process comments edit

Around the middle of last year I reviewed ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008. In a nutshell, I thought it was a good entry level book to multi-tier app development, but I didn’t think it really showed what “enterprise” dev should be.

Since then, I’ve gotten a lot of questions asking what book I would recommend to learn enterprise application development. Unfortunately, I didn’t really have an answer at the time… and I still don’t.

The problem is that, for a dev who’s never done anything much larger than a fairly simple web site or some console/WinForms apps, after reading this book it looks like “all you need to do” to get into enterprise dev is start separating things into tiers, and that’s not really accurate.

Really, you need to consider different technologies; different architectures; how the system you’re building needs to interact with other systems (if at all); who’s going to maintain it when you’re done; how the system should be extended; and so on. It’s more than just throwing a three-tier web app out there.

Because there’s so much to it, you really can’t just pick “a book” and call it good. You sort of need to pick several books, but even then, it’s not enough.

Think of it in terms of those “Learn to Program in 24 Hours” books.Say you read one of those and work through the exercises and do everything it says you should do. When you’re done, are you a programmer? No, not really. You might be able to put a simple program together, or even a complex one, but you’ll be missing a lot of the things that you’d get with experience - knowing which algorithms to use in certain situations, understanding the benefits and drawbacks to the tech you’re working with, and so on.

Same thing here: Can a book, or even several books, teach you enterprise development? I’d say no. You’ll never be able to just read a few books and throw “enterprise development” on your résumé. Can books give you a few building blocks that you can use, along with experience, to do enterprise development? Sure.

Given the constraint that you’ll be looking at .NET-based technology (since the original commentary was on a .NET-based book), here are a few suggestions. It’s by no means all-inclusive; the second I publish this it’ll be out of date (if it isn’t already); and while this is a .NET-centric list, you really need to look beyond just .NET so you can choose the right solution.

  • Design Patterns: Elements of Reusable Object-Oriented Software: Understanding design patterns will help you recognize different ways to implement various functionality as well as giving you a common language with which you can communicate your design. (You may have heard this book referred to as the “Gang of Four” book.) Should you apply every single design pattern in your code? No - it’s not a checklist. Will it help you do things in a standard way and maybe open your eyes to some different ways to solve the problem? Sure.
  • Design Patterns in C#: Less comprehensive (and easier to read) than the “Gang of Four” book, but provides concrete examples of common patterns in C# and helps to solidify some of the concepts.
  • Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries: This book will help you understand various patterns (and anti-patterns) that you should use in your code. It also addresses some issues like naming conventions that will help your source code be more discoverable to other developers who may come in to help or maintain the code. (FxCop analyzes your code for some of these rules. You’ll want to run FxCop on your enterprise app code. However, you may not want to run literally every single rule. I have some recommendations on which rules to run based on my experience.)
  • SOA: Principles of Service Design: If you’re not familiar with service-oriented architecture, this will help you become familiar. Remember, though, that SOA is just one option for separating logic into components. The ASP.NET 3.5 Enterprise Application Development book doesn’t even mention services, and that’s a big oversight.
  • Professional ASP.NET 4 in C# and VB: If your UI will be a web app, you owe it to yourself to get this book. It covers the ASP.NET pipeline and the common providers you’ll need to know about. While it primarily focuses on web forms, it does touch on ASP.NET MVC. Note that there is a lot to ASP.NET. It’s not just throwing a few controls on a page or whatever. This book is a behemoth at around 1400 pages with fairly small text. Be ready.
  • Professional ASP.NET MVC 2.0: A smaller book that focuses on the MVC portion of ASP.NET. This complements the more general ASP.NET book listed above. (At the time of this writing, the MVC 2.0 book is a pre-order; if you’re looking for something right now, get the MVC 1.0 book.)
  • Writing Secure Code: If you’re creating an enterprise app, it probably means you’re going to have a user base larger than one trusted user. You’ll want to make sure what you’re doing has security built-in from the ground up. Security is not an afterthought.
  • Code Complete: If you’re a developer of moderate experience then a lot of what you’ll find in here will feel like review. If you’re not, this book will help you understand some general good programming practices. In enterprise development, you’ll want to be aware of this stuff. It’s not just “jamming some code together.”
  • Code Leader: Using People, Tools, and Processes to Build Successful Software: Part of development of enterprise apps is the process - not just the coding, but how it gets built, how it gets tested, how it’s organized, etc. It’s meta-information about the app, not just the app. This book is a good intro to some of this process information. This one is sort of like gaining some “free experience” - it took a lot of us years to arrive at the conclusions you’re just handed here.
  • The Art of Unit Testing: With Examples in .NET: If you’re doing an enterprise app, you’d best be testing it. “It works” isn’t good enough at this level. While unit testing isn’t the only kind of testing you should be doing, it is fundamental. This book will help you understand how unit testing works and how to make a good unit test.
  • Other technology-specific books: You’ll end up with a lot of books that tell you how to work specific tech in .NET. Depending on your solution, you may or may not need these; or you may need more than this.

Like I said, it’s nowhere near a comprehensive list. For example, you’ll notice I didn’t include a database design book - not because there aren’t any good ones, just that I don’t have a specific recommendation. I also didn’t include a book for every single .NET-based tech; that list could go on forever. Windows Presentation Foundation, Silverlight, Azure cloud services… there’s a lot. I also didn’t get into every technology-agnostic programmer topic that would help - regular expressions, source code branching strategies, refactoring patterns, algorithms and data structures, etc. Again, that could go on forever.

However, all of this stuff is stuff you need to know, or at least be highly aware of, if you’re doing any sort of “true” enterprise development. It’s not just multi-tier development.

What do you think? Do you have a recommended set of books for enterprise application development? Do you think you can learn enterprise app from a single book? Several books? Or is it just something you need to learn with experience? Leave a comment and help out the people who are trying to learn.

media, home comments edit

Busy weekend this weekend, but got a lot done and had some fun, so it was one of the better ones.

Saturday my mom came over early and went with me to my 24th (and, ostensibly, final) laser hair removal treatment. (I’ll blog that in a couple of weeks after I see the results.) We tooled around town most of the rest of the morning, got some lunch, and headed back home.

In the afternoon my dad and grandpa came over and my dad helped me wire up some Cat-6 from my office to my living room. I have a feeling my Netflix issues are strongly tied to wireless network interference and since I’m looking at getting a new receiver with Ethernet built in, I needed to get a wire dropped in anyway. (No, my house wasn’t wired when I bought it. I wasn’t involved in the building of the house or I’d have had it wired to start with. As it stands, now I have to retrofit wires in and it’s not so simple with some of the sound barriers and things they built into my walls.)

Wiring that up meant me belly-crawling my way around in the crawlspace under my house, which sucks, especially when your flashlight burns out and you’re in the furthest corner of the house away from the door out. Feels a little like being in Saw, that. Plus there’s not actually enough room with all the pipes and stuff down there to really crawl so much as do that breakdancing worm move. My back and hips are killing me today.

After the wiring was done, we played Wii for a while and I showed my parents and grandpa how Wii Fit works. I showed them that it’s not just games, but also some different strength and yoga exercises. One of the strength exercises I showed them was the “plank exercise” - basically you hold a pushup position without moving for 30 seconds and it scores you on how stable you are. I’m admittedly out of shape, and when I showed them I got a 47 out of 100 for stability. My dad tried it and he also got a 47, so I didn’t feel too bad. Then my 88-year-old grandfather got up there and got a 96 like it was nothing. We were… suitably impressed.

Sunday I got some chores done, played a little BioShock 2, and then went to see the new Alice in Wonderland movie in IMAX 3D.

Disney's Alice in
Wonderland

I am an Alice in Wonderland freak, so I’ve been looking forward to this movie for a long time. That’s actually one of the reasons I paid the $15-per-seat to get the IMAX 3D.

Unfortunately, I didn’t anticipate this to be quite as huge as Avatar was, so I figured getting to the theater a half hour early would be plenty. I was wrong. Very wrong. So wrong we got stuck literally in the back row in the far right corner.

I was unaware that theaters would sell tickets for seats behind the rear speakers, but those were the seats we were in.

Needless to say, this affected my mood and my viewing experience.

The movie itself was good. It was very visually engaging, as expected with Tim Burton films, and did not disappoint on that front. It was nice to see a bit of a “reimagining” of the story and have a sort of “sequel” as it were. The characters were pretty cool and well acted and I never had that thing where I look at my watch and wonder how long is left in the movie. I wanted it to just keep going.

That’s actually the downfall of the movie, if you can call it that. I wanted more. I wanted to hear more about the White Queen, since you really don’t get much from her. I wanted to hear more about the rivalry between the Red Queen and White Queen. I wanted more background on the Knave of Hearts. I think I could have stood another 20 - 30 minutes to get some of that depth that was missing.

There’s also a bit of dancing at the end - you’ll know what I’m talking about when you see it - that could have been cut. It didn’t add anything to the film and was just silly compared to the rest of it.

Don’t let that fool you, though: I thought it was a great movie and I’ll be picking it up when it comes out on Blu-ray. In fact, I think I’ll like it better when it comes out on Blu-ray because I’ll have the opportunity to actually see and hear it all the way it’s supposed to be seen and heard.

The thing is, I don’t think I really got the full viewing experience sitting where we were. Skewed so far back in the corner, some of the 3D effects were blurry and weird rather than being actual 3D. (This was true even for the trailers, the same trailers I saw when I saw Avatar in IMAX 3D and looked fine.) The worst was the sound. There were times where you could tell that if you were sitting in the middle, you’d get this cool effect of some ethereal sounds floating around you, or some disembodied character speaking that should sound like it was in your head. I didn’t get any of that. Stuff that was supposed to be behind you was right over my head. Stuff that was supposed to be in front of you was way out front. The whole thing was very disorienting and actually detracted from my enjoyment of the experience, something I’d waited months for. Enough that I almost would rather not have seen it and just forfeited the tickets and gone some other time when I could have seen it with a decent seat. Very, very disappointing.

Anyway, definitely go check that out, but if you go for IMAX 3D get there ridiculously early or you’ll have wasted your time and your money like me.

dotnet, aspnet, gists, csharp comments edit

Messing around with ASP.NET MVC 2.0 (in VS2010 RC1), specifically the validation done with DataAnnotations, and created a simple no-op custom validator attribute like this:

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class MyCustomAttribute : ValidationAttribute
{
  public MyCustomAttribute()
    : base("Custom Error Message: {0}")
  {
  }

  public override bool IsValid(object value)
  {
    return true;
  }
}

Similar to the way the sample “PropertiesMustMatchAttribute” is set up - enabled on a class so you attach it to the model, not a property on the model, and set so you can have more than one.

I then created a simple model that used it like this:

[MyCustom]
[MyCustom]
[MyCustom]
public class MyModel
{
  public string SomeField { get; set; }
  public string OtherField { get; set; }
}

Notice I’m using my custom attribute three times there.

I then set up a quick view to edit the model, enabled validation, and put a breakpoint in the “IsValid” method on my attribute.

I ran the editor, hit the “save” button (to post the “edited” content back and get validated) and the call to my custom validation ran only one time.

You know what I missed? I didn’t implement TypeId.

This is documented as being a “unique identifier used to identify two attributes of the same type.” What’s not said there is that if DataAnnotations (or, at least, the MVC validation portion) comes across two attributes of the same type, it’ll only look at one of them. By default, TypeId is just the type of the attribute, so when two attributes of the same type are encountered, they’re considered “the same.”

If you set your AttributeUsage to AllowMultiple, you absolutely must implement TypeId.

You can see this implemented in the MVC “PropertiesMustMatchAttribute” as a new object (so they’re never identical). Updating my simple attribute like this…

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class MyCustomAttribute : ValidationAttribute
{
  public MyCustomAttribute()
    : base("Custom Error Message: {0}")
  {
  }

  public override bool IsValid(object value)
  {
    return true;
  }

  private object _typeId = new object();
  public override object TypeId
  {
    get
    {
      return this._typeId;
    }
  }
}

…causes my custom attribute to run all three times as expected.

What’s the use case for multiple attributes of the same type? In the case of the “PropertiesMustMatchAttribute” sample, maybe you have a model for registering a user - email, email confirmation, new password, new password confirmation. You want to make sure the two email fields match and the two password fields match. Two instances of one attribute, but working on different fields. Without implementing TypeId, only one of the validation checks will happen.

Once you get it working, sure, you can optimize some (for example, the “PropertiesMustMatchAttribute” could store the names of the properties being compared so if someone actually does try to run redundant validation it won’t happen), but that’s left as an implementation detail.

I went and took this color test which does a sort of career analysis based on colors you like and dislike.

It tries to get you to enroll in a school or something, so don’t give it your email address or anything, but it’s interesting and appears fairly accurate. Here’s my result (along with a description of the test):

The Dewey Color System® is now the world’s most accurate career testing instrument. This report based on your personality traits indicates your two most enjoyable day-day-day occupation skills. It’s a summary of the full report, the Color Leadership Evaluation 5.0.

Studies indicate workplace enjoyment is the key to success. So as you read, consider only “Was I mostly having fun at work?” Disregard your present and past employer’s environment.

Best Occupational Category You’re a CREATOR Keywords: Nonconforming, Impulsive, Expressive, Romantic, Intuitive, Sensitive, and Emotional

These original types place a high value on aesthetic qualities and have a great need for self-expression. They enjoy working independently, being creative, using their imagination, and constantly learning something new. Fields of interest are art, drama, music, and writing or places where they can express, assemble, or implement creative ideas.

CREATOR OCCUPATIONS Suggested careers are Advertising Executive, Architect, Web Designer, Creative Director, Public Relations, Fine or Commercial Artist, Interior Decorator, Lawyer, Librarian, Musician, Reporter, Art Teacher, Broadcaster, Technical Writer, English Teacher, Architect, Photographer, Medical Illustrator, Corporate Trainer, Author, Editor, Landscape Architect, Exhibit Builder, and Package Designer.

CREATOR WORKPLACES Consider workplaces where you can create and improve beauty and aesthetic qualities. Unstructured, flexible organizations that allow self-expression work best with your free-spirited nature.

Suggested Creator workplaces are advertising, public relations, and interior decorating firms; artistic studios, theaters and concert halls; institutions that teach crafts, universities, music, and dance schools. Other workplaces to consider are art institutes, museums, libraries, and galleries.

2nd Best Occupational Category You’re a DOER Keywords: Emotionally Stable, Reliable, High Energy, Practical, Thrifty, and Persistent

These adventurous types prefer action-oriented, concrete problems rather than dealing with thought-provoking, ambiguous, abstract dilemmas. Fields of interest include mechanical, construction, and outdoor careers. They might also enjoy working with machines, tools, and equipment to repair or build something.

I think people who know me would see it as pretty right on. Given my current occupation as a software engineer, I fall pretty close to where it looks like I should be - a mix between creator and doer. I kinda wish I had a little more in the way of “unstructured, flexible organizations” to deal with, but… well, them’s the breaks.

I wanted to be 3D modeler/animator at one point. That would have been along these lines, too. Hmmm.

vs comments edit

You may have noticed that every time you install the DevExpress DXCore/CodeRush/Refactor! products they go into a different install folder. For example, I have two versions installed right now:

  • C:\Program Files\DevExpress 2009.3
  • C:\Program Files\DevExpress 2010.1

The thing is, you can only have one version running at a given time, so it bothered me that there was a new install location every release. I felt like it was left to me to clean up a mess… but it turns out that’s not the case!

This “new install location for every release” is intentional because you can have multiple versions of DXCore/CodeRush/Refactor! installed and you can switch between them using a tool they provide.

Here’s how you do it:

  1. Close all the running instances of Visual Studio.
  2. Go into the IDETools\System\DXCore\BIN folder in the most recent install location. For me, that means C:\Program Files\DevExpress 2010.1\IDETools\System\DXCore\BIN. (Technically you could go to the folder for any of the installs, but I choose to go to the most recent just in case there’s been a patch or addition to the tool.)
  3. In that folder, run the DXCoreVersion.exe program.
  4. The version selected in the dropdown box will be the latest version installed, not necessarily the active version. That’s important and could be misleading.
  5. Select the DXCore version you’d like to be active and click “Run.” In this example, I have version 9.3 active so I’ll select to switch to version 10.1.
  6. A lot of stuff will happen - the version of DXCore currently set up will be unregistered and the version you selected will be registered. Note that while the log will talk about “uninstall” and “install,” it’s not actually adding or removing the installation from your system, it’s just hooking things up.
  7. Wait for the popup to tell you it’s done. It takes a couple of seconds and the Close button isn’t disabled, so it might look like it’s done, but it’s not. Once it’s done, you can click OK to dismiss the popup and close the version switcher.

You can use this process to switch from any version to any version [that you have installed]. If you make sure to keep your community plugins in the default location (under your Documents folder, not under the install location) then your community plugins will transition along for free.