Ask HN: Experienced C programmer, new to web, which language/framework to use?
I want to build a rich webapp, which will be a platform for others to create content. So the webapp will need to evolve continuously.
I have some experience of building a webapp in asp.net MVC (Microsoft's ruby-on-rails clone). What I am unhappy about in the Microsoft world is - lack of a good ORM, software licenses (offset by BizSpark), good deployment tools (appharbor is solving the issue but they are still a bit new).
I am an ok programmer in both ruby and python. But I am fluent in C# (with the new language primitives, its fairly equivalent, you can also write stuff in F#).
I can pick up a language fairly quickly if the framework enables an order of magnitude quick web development than other platforms.
My experience has been painful with ORMs so if a framework has a good answer I think that win alone seems fantastic.
[Edit: ORM issues: Number one issue was migrations on a live site. We ended up doing most ORM by hand to deal with no good framework support for migrations.]
64 comments
[ 3.3 ms ] story [ 106 ms ] threadBoth Rails and Django have lively helpful communities with great documentation and extensive libraries.
You could even play with both over a few hours and pick the one that has the style you prefer.
What was the issue you had with ORMs?
Language wise - I like being able to keep stuff 'typed' once the code base stabilizes a bit. Steve Yegge apart ;)
ORM - major issue has been migrations with .NET stuff.
What has been your/community's experience with migrations?
I am assuming that Ruby => Rails and Python => Django (Please correct me)
Even if that wasn't what hartror meant, you probably should still give this some consideration.
I have mostly scripted in Python and some in Ruby (for some existing codebase). Not anything significant.
I'd advise against Django then. Django is great when you have a small number of trusted contributors, but a pain otherwise.
I mean we are programmers are we not? If something doesn't immediately fit your needs it might be easier to just write some extra code yourself rather than investing the (sometimes) significant amount of time required to become truly expert in another web framework.
Regarding ORM, NHibernate isn't working for you? I haven't used it personally but have heard good things about it.
If you have time to evaluate, you can try building a mini app with Rails and/or Django before deciding. I recommend "Rails 3 tutorial" and Django book for learning Rails or Django. The Rails 3 tutorial builds a small twitterish app. Django book doesn't have a cohesive apps built in the book but the examples are all real world.
Currently, we are using MigratorDotNet (it meant writing sql to define Up and Down manually). We ended up with a custom implementation for doing the orm. (battle scars and hence the above question)
Yes, I do understand the impedance mismatch for true orm mapping but I sincerely hope to avoid "doing this by hand" until absolutely necessary.
http://news.ycombinator.com/item?id=2478537
That hasn't got many upvotes, so probably very few will see it, but it seems related enough to mention here and ask for advice.
Thanks in advance.
If you have some experience with ASP.NET MVC, you'll find starting with Rails easy enough.
<flame> Unlike Django, you have an up do date free ebook to learn from and many others available for purchase (http://programmingzen.com/rails-books/). And don't forget extensive free guides (http://guides.rubyonrails.org/).
Ultimately both will get the job done. Rails just has a richer ecosystem and a larger, more active community.</flame>
There is also Python vs Ruby documentation and library support to consider, of which Python arguably wins, though Ruby is catching up.
All that said both are a excellent option and IMO roughly equivalent.
http://www.djangobook.com/en/2.0/
The official Django tutorial takes little time to work through and I highly recommend it as a taster: http://docs.djangoproject.com/en/1.3/intro/tutorial01/
See jacobian's comment here saying "I know of at least one publisher who's decided not to print any more Django books because they decided they can't compete with the docs".
Django comprehensive docs were what convinced me to choose Django over RoR 3 years backs when I had to choose between RoR and Django first.
Before that I was using LINQ-to-SQL with a repository layer and StructureMap, but I spent way too much time writing repository methods and mapping columns manually. Do yourself a favour and try NHibernate without the XML mappings.
I definitely cannot afford Red Gate's prices until funding.
We have a pretty straightforward database library which lets you avoid writing SQL but isn't a full blown ORM that you can check out here: http://www.akshell.com/docs/0.3/guide/db/
PG says it well http://www.paulgraham.com/pypar.html
I know plenty of companies struggling to fill RoR programming slots and are paying above market average for them. They are doing fun and exciting things.
Of the 1.3 million software developer jobs in the US maybe a few percent at most are in Ruby, and most of those are concentrated in a handful of locations.
PHP and C# usage is much higher and distributed across the US.
Looking to figure out what the best hackers in the world think are good tools to use and then start using those. (Since I have to most-likely learn new tools anyway).
Reading HN, it seems people work with Rails, Python (Django/Pylons/WebPy/?) and Node.js
Basically wanted the experience of people who built something more than toy projects minus the flame war :-)
Someone else here compared ruby to python. They said ruby is quicker and smoother for UI programming, python is faster and better developed for computation. I think that answer is dead on.
In general, ORM pain decreases significantly as soon as you go with a dynamic language like Ruby or Python. Hibernate nearly made my head explode the first time I saw it.
In summary: I would recommend Ruby, Sinatra and DataMapper as a starting point.
Unlike Rails, there really aren't many conventions to follow, and things don't seem to break between releases as they do with Rails (from its constant and exstensive evolution).
I'll also throw in a recommendation for using HAML if you're building any HTML for the client side.
(Apparently the 'razor' syntax is inspired from HAML in .net, so I think I get what you are saying)
Also there are plenty of ORMs for node.js - I like Mongoose and mongodb personally, but there are several others.
For apps that are primarily user facing, I think Rails is way ahead. The framework is well-designed, but more important than that are the plugins--the number and quality of polished, batteries-included, well-documented plugins are unmatched by other frameworks I've looked at. The amount of time and effort this saves is incredible. Ruby is also a great language and though overall it doesn't feel quite as nimble to me as Python, it has added power in some areas (like blocks), and its OO model feels more pure than python's. Heroku is another huge benefit for Rails, as are tight integration with HAML, SASS, and CoffeeScript (much improved syntaxes for HTML, CSS, and JS, respectively).
On the python side, I've used both django and web2py and I found web2py a much more productive framework even though it has a smaller community, so web2py is the basis for my comparisons.
While I've found Rails to shine for primarily user-facing apps, I think python could be a better choice if your app is less user-focused and more oriented towards data processing, number crunching, and other heavy lifting on the back end. Python has a more mature ecosystem of libraries for these kinds of tasks, and given that I find Python to be more fluid and expressive than Ruby, I'd prefer it for writing in complex logic that goes beyond the typical CRUD scenarios.
There is a feeling when participating in Python communities that more emphasis is put on data manipulation and abstraction, and less on ui, user experience, and polish, which tend to receive more utilitarian treatment. In Rails, the pattern is reversed.
To answer your question to some degree - the app is primarily user facing. I would also want analytics and a dashboard for the user based on the activity they see on the content they create. (But no complex number crunching)
http://news.ycombinator.com/item?id=2407334
http://news.ycombinator.com/item?id=2436885
http://thechangelog.com/post/4608227295/raphters-a-web-frame...
ROR is very good at consumer facing apps, but there is a bit too much there there to learn quickly, or to use for other purposes (iPhone app backends, etc) for people new to the platform.
Either will serve you well once you master them, and I'd learn both eventually.
Most tutorials and guides for RoR teach REST from page 1, so once you have some familiarity with Rails routing, using it as a backend is simple enough.
(the article's gone, but there are some excerpts at http://gadgetopia.com/post/6839 )
LINQ-to-SQL is another great option that's easy to set up and actually performs pretty well if you compile the queries.
Fluent NHibernate is much heavier duty, but once you have all of your mappings set up then it's braindead easy to do anything to your database.
If you're using Mongo in C# then I highly recommend checking out the NoRM project - it's like LINQ-to-SQL for Mongo. I'm using it in production at http://captainobvio.us and it's been a breeze to work with
I didn't find myself productive in Linq-to-sql.
(Must explore Fluent NHibernate, in our project we were too far along to invest in a new ORM).
This project/startup is starting from scratch so I'd rather use the 'best' tool available.
Though that alone doesn't say much. I recommend first of all you write the code in coffee-script and not in javascript.
Node is bare-bones and the choice of template languages and what not is left up to you. I recommend stylus for css, and jade for html templates.
For databases I recommend MongoDB (or some other nosql type database). There's a Node module called 'mongoose'; it seems decent but I haven't used it so can't say much.
MongoDB uses flexible documents (json objects) instead of sql-type tables, and allows you to add/remove fields dynamically to individual objects ("records") without having to redefine a "schema". So at least in theory it should make migrations a lot easier.
Why do I recommend Node instead of Django or Rails? Simple: I think it's the future. Node.js is very lite, has an awesome package manager, lively vibrant community, solves the concurrency problem beautifully, it's evolving rapidly, but more importantly: it makes simple things simple.
Ever saw a comparison of a "hello world" in Java vs. Python? Java requires you to do a lot of setup upfront, where as python just lets you say:
Well, Node is kinda like that.Creating a project in Django and/or Rails requires a lot of boilerplate. Where as in NodeJS it's a single .js file with about 5 lines of code. And sure, Django/Rails have tools to automate the creation of this boilerplate, but it's still a clutter to your environment.
(For the record: there is a lite framework for python called Flask, but it lacks all the other benefits of Node)
I have another question - I'll google if you don't get a chance to answer - how do rails and node.js play together? (real world experience)