
It’s not what you think, exactly, but close. I have been interviewing again, this time for a full time position. During my search, on one of the interviews, I was asked to use the PEX coding for fun website to flex my programming muscles.

It’s not what you think, exactly, but close. I have been interviewing again, this time for a full time position. During my search, on one of the interviews, I was asked to use the PEX coding for fun website to flex my programming muscles.
1 year, 12 months, 52 weeks, 365 days, 8,760 hours, 525,600 minutes, 31,536,000 seconds and for once, I am happy with the way I spent them. Most years I look back and think “I should have done better” but not this year. Satisfaction with everything is easier to attain when the bar is not perfection.
For me perfection was debilitating and would keep me from finishing, or worse, starting projects. My bright ideas were perfect until they were brought into the light. That’s usually when my drive to finish a project would wain or completely fail me. So to help me avoid my need for perfection, I made sure that I produce something. Even if it was a total pile.
Produce I did.
Yes, I switch my blog again for the 10th time. Now with more awesomeness. The combination of Octopress, a heavily customized Jekyll static site generator with some sass and compass CSS wizardry. The best part of Qctopress is the ease in which I can deploy the static site to GitHub to get some free hosting.
It’s funny how the same topics keep coming up over and over again. The other day I wrote about batch processing in Asp.net and today a college forwards me an article about “The Dangers of Implementing Recurring Background Tasks in Asp.Net” from Phil Haack.
Warning: Phil, I am going to give you some grief, but you are awesome. How can you not be with Asp.Net MVC.
Phil is a Senior Program Manager at Microsoft and Mr. Asp.Net MVC. A good guy, but I find it funny when you comment on your blog like this:
I run Microsoft OS’s with Microsoft IIS and program websites with Microsoft languages and frameworks but can’t do reoccurring tasks without punting out of the web project and into Windows Services or console programs. Don’t get me wrong Phil, I know you are busy but what the heck! Where is the worker role from Azure?
I suspect that Microsoft can figure out how to give it’s most popular development server (IIS) the ability to do batch processing. How can IIS in its 7th version not have the same features as Azure beta or AppEngine from Google? Can you say Cron.yaml?
How do you turn an object orientated language like C# into a procedural language like COBOL? That’s right you make everything static. On a current project we have a business DLL with 39 code files and 412 instances of the static keyword. That’s +10 per code file. Here is the screen shot from Visual Studio 2010.
You might be asking “What’s wrong with this?” and if you like spaghetti the answer is nothing. Some people say that object orientated code is complicated because of the hiding of implementation in base class’s obscures what the program does, but I can also argue that seeing all of the implementation details in static classes obscures the forest because of the trees. Either way, too far to the left or right and you will have issues. A more moderate approach is swinging between the paradigms and choosing the correct design techniques.
Choosing between static and instance methods is a matter of object-oriented design. If the method you are writing is a behavior of an object, then it should be an instance method. If it doesn’t depend on an instance of an object, it should be static. Remember, testing static methods that have dependencies are notoriously difficult to isolate and Unit test.
I am 38 and I love what I do. Later in life will I still be developing? This may shock you but the mainframe gives me hope. Have you ever walked through a mainframe development department lately? Well I have, and I must tell you it’s grey. Yep, that’s right grey hair or if fate has been cruel to you no hair.
You might be asking why where you walking through a mainframe department. Well it’s a funny story. One day an architect on my team came over to my desk and said he needed me to help a team connect to one of our existing web services. That’s right; he walked me right into the mainframe developer’s lair. It was surreal. I am thinking to myself how do I get a dinosaur to drive a Prius? My architect introduced me to a gentleman that could have been old enough to be my grandfather and abruptly left.
After some awkward questions like, do you use SOAP? Can the mainframe understand XML? Do you have a SOAP client or are you going to submit xml blobs with replaced sections? I was amazed when they said “yes we use SOAP and have a client for the mainframe”, I thought of that Prius with a dinosaur driving down the street.
At my grandfather’s age will I still be coding? I hope so and now I have hope because of the mainframe and there developers. Live long enough and the world will surprise you. Here’s to the mainframe, long live the mainframe!
Part of my job at many clients has been interviewing new candidates. It’s a thankless job, that if not done well, can cost you and your client dearly. All of us have had the torturous interviews with Google searching morons that ask you questions like how is a hash table implemented, to which I respond “I don’t care if it works.”
There are two different types of interview questions, the specific and the general. Questions like “What color do you get when you add blue and yellow together” will only tell you they know how to make green. A better question is “How do you use a color wheel.” Can you see the difference?
When I interview a candidate for a position, I use a set of questions that dips or tunnels into the specifics on their knowledge and background. Here is an example:
How many lines in an Asp.Net code behind file is too many?
If they answer with something reasonable like 200 lines, then I would move on. If not, then you might have other questions.
How would you break up a code behind file to be smaller?
Again, hopefully, they say something about user controls and breaking up the functionality on the page and not move the hard coded injection flawed SQL queries from the code behind. Then you can dig a little deeper and ask something harder like:
How do you communicate from one user control to another or to the host page?
If they answer this last question correctly, you know that they know what’s going on in Asp.Net and not that they have memorized the page lifecycle. Did you notice who would have to do most of the talking? That’s right, the candidate. You can pick up a lot from these conversations.
So you need to do some work that is not a logical part of a web request and you are looking for options. Well, we got options and a lot of questions.
Ok, all kidding aside, some of these questions have real impact on how good your batch processing job will perform and how often you will be babysitting it. For a simple site with a small batch processing need, I would use the old timer trick in a http module right in the web site.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
This technique has many issues and should only be used for the simplest things. Some issues include the app pool recycling and shutting down your batch processor. Others include having to make your processing code reentrant.
If I was asked today to do batch processing for a client, I would use a Windows Service with WCF backed by MSMQ or some other distributed asynchronous message system that would scale when nodes are added to the cluster. Even if this app was run on a single server, I would still use a local MSMQ queue to start. The atomic way that MSMQ distributes messages and the benefits of throttling, discreet work packets, dead lettering and scalability outweigh the initial complexity of the solution.
There are many platforms today that make batch jobs easier like Azure worker roles, AppEngine and Heroku, not to mention, cron on Unix platforms. I know about the Windows Scheduler and the pain of using it in production. I was hoping that Microsoft would add the worker role functionality to IIS and Asp.Net but it does not look like the cool app fabric features will be coming to IIS.
Have you ever had a client that wanted to do dynamic time of day IP filtering of a WCF service? No! What do you live under, a rock?
Well, I have and this is how I solved it. First, we look for better options like not writing code and use IIS IP Filtering. After that’s rejected by the client, I fire up my IDE; it takes so loooong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
I am a big fan of how WCF can be composed so I used a ServiceAuthorizationManager and added it to the services behaviors through the config.
1 2 3 4 5 6 7 8 9 10 11 12 | |
I left out the boring part about which IP addresses are allowed and at what time, but I think you get the point. These dynamic rules for access to a WCF service can get a little sticky but WCF has some great extensibility points that allow you to solve your client’s problems. I have also used the same type of dynamic service authorization for use with Active Directory Groups.