Archive for June, 2012

My Ruby on Rails photo site hosted on Heroku

In a previous post that I wrote on the topic of deploying web applications on to Azure cloud I compared that to my experience of deploying Ruby on Rails web apps onto Heroku.

I realised that I’ve not mentioned my experiences with coding in Ruby. My motivation to learn Ruby On Rails was triggered by the fact that I was developing a rather large Asp.Net MVC web app in my day job, and according to one of the books on my reading list it was the inspiration for the Microsoft’s framework.

I’d returned from a holiday in Russia and I wanted to share the photos with my friends in a novel fashion. Why not create my own website to share them and learn Ruby On Rails in process? As a result, I created a few sites using RoR, this one being the public clone of my photos website The rest of this post covers how I launched these sites.

After a little googling, I decided I would do my Ruby development on a Linux based OS as opposed to Windows, since I would be able to keep up my Linux knowledge. Vim was to be my text editor of choice.

To get a grasp on the Ruby language I started working on the Ruby Koans exercises and once I felt sufficiently competent I moved onto understanding how it weaves into Rails to result in the accomplished and popular web framework. Michael Hartl’s Tutorial is the perfect place to start

I dabbled with deploying a Ruby On Rail web app on Phusion Passenger without much luck, so I then decided to take the simplest route to hosting and go with Heroku. I’d already decided that I would learn Git quite some time ago; now would be the time to take the plunge!

Along my path of deploying the web site I went for the option of using a mature open source photo site called Balder. Doing this meant I could get my web site launched in a reasonable time frame, and to also avoid reinventing the wheel

Overall I felt it was a positive learning experience. I started to learn a new language and framework, which allowed me to appreciate MVC.Net and see where Ruby isn’t so great in comparison. For example, Ruby’s concept of Active Record may be useful for rapid development, but it lacks the strengths of Fluent NHibernate. Some have argued that Active Record is itself an anti-pattern.

I became much more familiar with the Linux Terminal and I’m happy to see that Windows Power Shell has Windows analogues to Linux commands I’ve committed to muscle memory. I’m also a big Git fan and I’m comfortable using it at the command line.

With my understanding of git I’ve come to use Github too, and all the great ideas that flow from it.

It was a worthwhile endeavour, even just for the insight gained. You can visit the fruits of my labours and see for yourself: http://publicpics.herokuapp.com/

, , ,

No Comments

Recommend reading: Programming Books for C# web development

The best software book that I’ve read is undoubtedly Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin), which changed my approach to programming entirely. Bob Martin’s highly readable examples really push home the strength’s of SOLID design principles, without being too abstract or dry unlike the original Gang of four Design patterns book

His follow up book The Clean Coder is worth a read, covering important “soft skills” that a good programmer should have in order to work with all stakeholders in a software project.

Effective C#: 50 Specific Ways to Improve Your C# provides a plethora of C# idioms and techniques, and importantly it shows the reader when to use them correctly and when their use is *not* appropriate. I discovered many efficient ways of writing code and I felt obliged to revisit some recently written code to apply my newly found knowledge.

Head First Design Patterns makes for a great way to become familiar with design patterns and understand the correct circumstances to use them. All the code examples in this book are in Java. Given that I started learning Java at university I’ve had little trouble applying the patterns in C#, as they are quite similar languages. I find that I revisit the book to refresh my memory, so it will serve you well as a reference book.

I was lucky to be recommended The Career Programmer: Guerilla Tactics for an Imperfect World by a software professional before I actually started working in the commercial world of programming, so it has influenced my working practises from day one. Focussing on how to deliver software projects in environments that are hostile to efficient work, this book will guide you how to become a productive and valued developer and make your boss love you (or at least appreciate you!)

Growing Object-Oriented Software, Guided by Tests is required reading if you intend to understand, appreciate, and get the best out of Test Driven Development.

I have been fortunate to attend a training course by the author of Specification by Example: How Successful Teams Deliver the Right Software, Gojko Adzic, when he came to my workplace. Although I’ve not yet read this book in its entirety (there is a copy on my desk) I can see it covers most of the topics I learnt in Gojko’s course. The implementation we chose as a result from the course was to use Specflow to write out our scenarios, as described on Steve Sanderson’s post

Speaking of Steve Sanderson, anyone who wants to write MVC.net web applications should read his book on the subject. Pro ASP.NET MVC 3 Framework 3rd Edition. If it is like the MVC 2 edition that I’ve read, he’ll bring you up to speed with MVC and show the benefits over ASP.Net web forms.

Code Complete: A Practical Handbook of Software Construction while I haven’t read it cover to cover unlike most of the books I’ve described above, it does have some useful knowledge tucked away, yet it lacks the succinctness of Clean Code

Finally, I’m currently reading and enjoying Dependency Injection in .NET which is a pattern that can be extensively using in the MVC framework. The code examples in the book model accurately what I’ve used in production sites, so the book gets my seal of approval.

Do you have any suggestions? What do you think is should be essential in a web developer’s reading list? Leave a comment and let me know your thoughts

,

No Comments

.Net web apps hosted in the Azure cloud

Update: 08 Oct 2012 I discovered that Azure will not allow usage caps, so I have discontinued my subscription in order to prevent excessive charges. I’ve left this post here for historical reasons. I may explore other hosting alternatives in the future

I’ve recently switched over two of my demo web apps I wrote some years ago into the Microsoft’s Azure cloud service, something that greatly simplifies deployment and reduces my web hosting costs.

The first is No longer active, see beginning of post My remote control demo application which was an exercise to show an example of the command pattern

More sophisticated is my blackjack game, No longer active, see beginning of post which in a previous post in I showed its design.

Given that I wrote these programs in 2009, I certainly would not implement them again in the same way, as I was using some old technologies that have since been superseded (web forms, Linq to Sql) and my code would this time around implement SOLID principles.

Having previously set up and deployed Ruby on Rails websites on the excellent Heroku platform, in comparison Azure requires much less initial set up. Azure being built into Visual Studios means the developer is shielded from the complexities of deployment.

Counting in Heroku’s favour is the deployment speed; simple Azure apps take at least seven minutes to deploy, compared to around 30 seconds for Heroku.

For example in Ruby On Rails once you have set up the rake file to deploy locally, you can make a few alterations to that file for production setting and then run it on the Heroku instance in exactly the same manner as deploying locally.
Azure invents a brand new deployment work flow for the local copy of the cloud, which feels alien.

However I’m somewhat comparing apples to oranges, but I thought I’d share my insights. As a platform I’ll now be using Azure over independent web hosting.

One minor gripe when migrating data from a non-azure database to an Azure database was being forced to create clustered indexes which were not necessary in the original database.

, ,

No Comments