Showing posts with label ruby on rails. Show all posts
Showing posts with label ruby on rails. Show all posts

Monday, April 23, 2007

Web Site Frameworks

My current project has me working in Coldfusion, which is very different from ASP.NET. The most fundamental difference is that it doesn't try to use controls and objects in a codebehind. Coldfusion makes it easy to run queries and output results but mixes database code in with HTML. On one hand, pages are in one file and database access is very easy. On the other hand, the form is strongly typed and you can easily modify page elements in code but the viewstate is quirky but too useful to turn off. They're quite different and I don't know which I like better.

Given only those two choices, I'd go with ASP.NET. Subsonic takes away a lot of the pain of the database access and it's just really handy to be able to say "DropDownList1.Items[1].Selected = true". I think the Coldfusion / ASP method may have more potential with an awesome IDE that's realizes that it's creating a web app (make it easy to get to the querystring / session / database). A hybrid method may be good, something like using HTML controls with properties but that don't get persisted across postbacks.

Rails has a completely different paradigm where you don't create pages, you create controllers and views. I think the best thing about this is that all of the code concerning an object is in one place. Each page has its own view that has very little code. The distinction seems to get murky if you want AJAX because you need javascript code in the view. Also, the view and controller are loosely connected with only an implied contract and unit tests, so I don't know if this is the best way to go either. It probably has the most potential with an awesome IDE, but it doesn't have corporate backing which means that IDE isn't coming anytime soon.

Saturday, March 24, 2007

ASP.NET vs. Ruby on Rails

If you're a contracter and you're being paid a flat fee to develop a simple website that basically only collects data and creates reports, what language and toolset do you use? You don't have to every do maintenance and you can't fix bugs. You want to get it done as quick as possible since you're being paid a flat fee. You have the freedom to choose whatever hardware and software you need. Obviously, your personal skill set is important in determining your answer but for me, it's a decision between ASP.NET and Ruby on Rails.

I believe in RoR. I think that it's a great way to build a website, especially one with requirements like these. My main issues involve its maturity, its tools and my familiarity with Ruby. Maturity isn't a problem in itself, but there are other problems that will go away with time, and I see this as an immaturity issue.

There's too much room for error in deployment because I have to TTY into the server and type things into a command line. I also feel like I need to know a lot more about Apache or FastCGI or Mongrel or whatever. I don't trust the RoR tools. There don't seem to be very good IDEs for working in Ruby, largely because Ruby is so dynamic that a new type of tool is required. The libraries are untrustworthy because they're not standard. I don't want to deploy (or even work with) a library with bugs, and I don't know where to find out which is the mature library.

I'm only considering ASP.NET a viable option because of SubSonic. Without that library, I'd spent way too much time writing and debugging data access code. The issues I have with ASP.NET are the inability to create unit tests without bucking the framework and unnecessary complexity of using controls instead of HTML. ASP.NET doesn't do MVC. It has views and no controller, which is quite untestable. Last I used it, NUnitASP was the best way to test it but it couldn't come close to testing an entire site with AJAX and everything else. I've become increasingly uncomfortable with using the ASP.NET controls when they're anything more than thin wrappers around HTML controls. (Except the Login controls in 2.0 which I love. Feel free to stop reading now.) As I rely on them more, I see more side effects and I find that I'm fighting with them or writing code that I feel is like a hack. A master-detail view should be easier and have fewer corner cases.

MonoRail is getting close to usable but it doesn't have a view engine I'm comfortable with. I fully acknowledge that it may be the best option, but I'm going to need to test it out first, and I haven't.

I'd go with ASP.NET. I think it may take slightly longer but it would be easier. The tipping point is RoR's toolset. With ASP.NET, I can use Visual Studio and set up pages using the designer.