Archive for January, 2010
Medium Trust is a PITA
Jan 31st
There. I said it. Medium Trust is PITA. I wont be surprised if someone replies with one of the following:
“Well, not really, you only have to do x, y and z and your code is compatible with medium trust environments”
or
“It’s there (Medium Trust) because code needs boundaries within controlled scenarios such as hosting environments.. “
Blah. Blah. Blah. You’re both right. However, it’s still a PITA. Why? In the past 4 months I’ve spent countless hours figuring out why my app is broken in a medium trust environment. I use certain tools to make my life easier (such as Castle Active Record, Windsor, ASP.NET MVC, Spark, etc) yet a lot of them assume full trust. They do have options to get them running under partial/medium trust but in my experience the debugging of these tools in said environments sucks.
Needless to say, I just got done debugging for 2.5 hours why my Spark MVC site would not precompile my views. The error was “No Input could be found". WTH!?! Finally, after walking through my app line by line I found the following in a Spark view:
${Html.ActionLink("Track Admin", "index", new { controller = "track" })} ${Html.ActionLink("Speaker Admin", "index" , new {controller="speaker"})}
The problem is that I had deleted those controllers and moved that part of the app. Once I removed the code, it recompiled fine. Completely frustrating and the root cause of this is Medium trust. I just spent 2.5 hours working on a debugging issue for Medium trust when I could be creating my app for a mobile start up company that I’m heading up.
Long story short : I’m not a fan of Medium Trust. I don’t know many people who are.
How Can we Get Around It?
I’m not sure we can in the .NET space. Other dynamic languages don’t seem to have these issues, but they do run into odd edge cases at runtime which can be even more of a pain to handle. So at this point, the only answer I have is to recommend any open source or commercial vendor to test their product on a lock down medium trust environment and provide very clear and concise instructions for how to get their product to run under medium trust.
New DimeCast: Spark Partials Part 2
Jan 28th
I have another DimeCast up on DimeCasts.net.
More Info: In this episode we are going to continue looking at how to use Partials within the Spark View Engine.
In this episode we will take a deeper look at partials and learn more about their _undocumented_ features. We will also be learning how partials will allow us to create clean, compartmentalized and well organized code.
Check it out here.
I’ve Moved to WordPress
Jan 28th
I’ve moved my blog engine once again. I started with DasBlog, then went to BlogEngine.NET and now I’m finally on WordPress.
Why WordPress? You’re a .NET guy …
Plain and simple. What I had, didn’t work and I need my blog to work, and work quickly. I don’t have time to write plug-ins, hacks to fix something I didn’t write simply so I can communicate with everyone via my blog. I need a solution that allows me to fire up my blog or Live Writer and create an entry very quickly. I need a solution that allows me to add the new whiz-bang widget created by Developer X. I don’t want to be a blog widget developer, I am an entrepreneur. My time is better spent figuring out business problems with code.
Secondly – My Host, RackSpace Cloud didn’t work well with Blog Engine .NET. I spent 3 hours trying to figure it out with their support team and they said the problem was my fault, I said it was their fault and we went back and forth. When it comes down to it, the problem was that when I created a new post, a new xml file was created in APP_Data and it was not being propagated across the cloud. Some users would see my post, others would not. A royal PITA.
Long story short. Yes. It’s WordPress. Yes. Its PHP. Yeah, I’m running this on Apache. Yes, I write .NET software for a living. But as I said in my last post, go with what solves the problem. Use what gets the job done. WordPress does that for me right now. Who knows, that could change in the upcoming years.
MVC vs. WebForms. Stop It.
Jan 22nd
Since Microsoft joined the MVC foray with ASP.NET MVC (other options existed previously, such as Monorail) I’ve personally witnessed (and been part of ) a lot of MVC vs. WebForms discussions. Usually these discussions end up with opposite sides taking their ball and going home in a pissed-off offended rage. Usually the WebForm fans snicker and say “Why change whats broken, I have X number of users and I make X money off of my app which has X % of uptime and it work great!”, etc etc etc. They’re right. Why change it? The MVC folks usually reply with “What about standards, ease of use, integration, ease of use with js frameworks, restful architectures, separation of concerns, SOLID, maintainability, and testability as well as a working app”? They’re also right. What about those things the MVC fans talk about? Most of those things require you jump through some hoops to do them in WebForms. Some of these problems were solved long ago by some smart WebForms people. Thats the counter argument. But then again all programming problems have a common counter argument – Hasnt everything already been solved by Lisp and Smalltalk (or so the saying goes)?
Each side of this arguments has their own opinion and their own valid points. So be it. Learn to live with it.
Personally, I’m a HUGE ASP.NET MVC advocate. However I’m realistic in my thought process and I use the right tool for the right job.
Here’s a perfect example: This last weekend I helped lead the Twin Cities GiveCamp team to a successful web project implementation for the Animal Humane Society. The solution was a web application. Almost everyone I know would say “Oh cool! You did a nice fancy MVC App right?!” Nope. Sure didnt. Myself and the team agreed that while MVC was what WE as a group wanted to do, it wasnt the right thing for the job.
We had 48 hours to create a solution for the non-profit. We needed simple app that was forms over data and we also needed to make sure that anyone who maintains this code base in the future would be able to update it. With not everyone knowing asp.net mvc we chose WebForms. Everyone on the team knew WebForms and how it worked. If we went with MVC I think the solution might have have been cleaner, but I do feel we would have NOT completed the job on time. In the end the MVC learning curve was too much for the team. Therefore in this instance, MVC was not the correct choice. We ended up using ASP.NET 3.5 WebForms, jQuery, and some other controls to get the job done. It worked out great and we’re in the process of setting the client up with a hosting account with DiscountASP.NET so they can start using the app as soon as possilbe. Choosing web forms allowed us to get the app done save their organizatoin time and money which allows them to improve treatment and facilities for the animals (which is the real end goal). If we chose MVC we most likely would not have finished and the entire event would have been a failure. No business problem solved, plain and simple.
The proof is in the pudding: Use what works best for the given problem … and really … who cares what technology you use to implement a given solution. If it doesnt work, you failed. If it works, you succeeded. This holds true if you’re using ASP.NET vs. Rails vs. PHP vs. JSP. In the end, ship working software. Otherwise, you’ve taken a long ride on the dreaded fail train.
What I’m trying to say is … do what you need to do to get the job done. Don’t be a technical-framework-nazi. If you love ASP.NET MVC, cool! If you love WebForms, cool! Get the job done, get paid, pay your bills and go home and spend time with your family.
What’s a big deal to you today, won’t be a year from now. Remember, no one ever laid down in their deathbed thinking “Ya know what, I should have used ASP.NET MVC for that one project.”
GiveCamp 2010 A Success
Jan 18th
This last weekend I hosted and participated in the first Twin Cities GiveCamp. We created a solution for the Animal Humane Society which they were very happy with. I’m happy to say that the event was a success!
Here’s the success annoucement on the give camp site. A huge thank you goes out to everyone for helping this event come to fruition!