Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Experienced C programmer, new to web, which language/framework to use?
44 points by architgupta on April 24, 2011 | hide | past | favorite | 62 comments
I am an experienced programmer in C (mostly systems / file systems and networking code, writing high performance code). I also have a lot of programming experience in C# (college and internships)

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.]




As far as the Rails vs. Python framework discussion, I've found that the best choice depends on what sort of app you're building.

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.


Interesting. Mostly when I have tried to understand this (recently), the answers have been religious in tone and nature.

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)


Your being worried about ORM reminds me that I felt similarly in your position, years ago. Looking back, I think this may be partly a lack of experience with languages with memory management - you simply have to learn to let go. But there is also a valid worry about flexibility and the degree to which you are losing the power of SQL. To address that you need to think carefully about what you are doing and have some faith in the experience of others. If you go with Django, and want to make a normal-ish web site, Django's ORM is fine. In fact, it's surprisingly powerful for what it is. But if you really want to be able to access SQL within your ORM then, at least for Python, you need to use SQLAlchemy. The downside is that SQLAlchemy will complicate Django. So I would suggest starting with Django alone, and really giving that a fair chance, and then, if necessary, looking at SQLAlchemy.


Django vote here. No disrespect to Rails. Depending on needs, take a look a mongodb as you can mix that in nicely (with pymongo). Node is intriguing as well - though not really a complete framework.


I think C# and ASP.NET MVC has some of the best options available as far as OR/Ms go. Dapper, which was open sourced by the StackOverFlow team, is something I just started using and it took me all of 5 minutes to pick up. It allows you to still write your own custom SQL statements but maps everything to a family of POCO objects you want to use. Dapper is also the fastest OR/M in C# terms of its benchmarks if that's a concern for you.

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


Dapper's first public domain checkin is on 31st march 2011. That's very bleeding edge adoption :-)

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.


> I want to build a rich webapp, which will be a platform for others to create content.

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>


"Unlike Django, you have an up do date free ebook..."

http://www.djangobook.com/en/2.0/


I'm a Django user myself and I used this book a few years back, but the current version is quite out-of-date.

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/


Thanks, I did not know the book was out of date. I also used it years back and have just used the regular documentation since then.


http://www.revsys.com/officehours/2010/nov/05/

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.


Rails certainly has a larger community than Django's, but I have found the signal to noise ratio is higher on the Rails communities as well. All that attention has come at a cost.

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.


Higher signal:noise is good, right?


I made a similar leap from C/C++ and C# without much web development a year ago. I have since developed several projects using both Rails and Sinatra using both ActiveRecord and DataMapper for ORM. The Sinatra/ActiveRecord combination is my current default.

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.


I second Sinatra+Datamapper. I'm not much of a web developer, but I really love the simplicity of Sinatra. Using it is like C, in the sense that it provides very little for you (ie. it stays out of your way).

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.


Thank you both. I was ignorant of Sinatra and Datamapper.

(Apparently the 'razor' syntax is inspired from HAML in .net, so I think I get what you are saying)


Padrino is also at a nice waypoint between rails and Sinatra. I recommend Sinatra for hacking out the basics of an MVC app then switching to Padrino once the generators make sense.


Which do you prefer Ruby or Python?

Both 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?


I am neutral. (I don't grok either right now is the more accurate answer)

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)


I think hartror's meaning was the same as "Do you prefer the language Ruby to Python, or vice versa?" The idea is that if you like Ruby(for example) better, Rails is the way to go.

Even if that wasn't what hartror meant, you probably should still give this some consideration.


To clarify - I meant I am not partial to either language (as in I don't grok either very well).

I have mostly scripted in Python and some in Ruby (for some existing codebase). Not anything significant.


Exactly what I meant :)


Django isn't the only popular Python web framework. I suggest taking a look at Pylons also.


Raphters C web framework might interest you. I haven't used it so can't attest, and it's new, probably not as mature as Rails/Python frameworks/etc. But just in case:

http://news.ycombinator.com/item?id=2407334

http://news.ycombinator.com/item?id=2436885

http://thechangelog.com/post/4608227295/raphters-a-web-frame...


I would recommend Node.js

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:

    print "hello"
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)


Why is this downvoted?


I'd like to know the same


Nevertheless, your views on Node.js has made me very curious and I will investigate.

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)


Fluent NHibernate solved all my problems. I asked a similar (strangely, downvoted) question on SO: http://stackoverflow.com/questions/5522590/rapid-orm-for-pai..., which prompted me to check out Fluent NHibernate.

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.


What's your experience with migrations? Non-trivial ones where SchemaUpdate doesn't work..


I used Migrator.NET for a long time with no problems and I'll probably still use it. But if you can afford it, SQL Source Control by Red Gate is awesome and integrates with your code repository, e.g. Mercurial.


Yes I use Migrator.NET as well. Works pretty well for us (no active development on this project though - there are github forks now).

I definitely cannot afford Red Gate's prices until funding.


> I want to build a rich webapp, which will be a platform for others to create content.

I'd advise against Django then. Django is great when you have a small number of trusted contributors, but a pain otherwise.


You know all that beautiful admin of which I assume you refer to? All that code is exposed, documented and very easy to use/customise.


I know, but it's not just the admin system. Others may disagree, but Django is written for newsrooms, (where it thrives); I just don't find it suitable for applications with many untrusted users.


There is nothing in Django that makes it inherently unsuitable for untrusted users. There are plenty of authentication / authorisation modules available for it such as OAuth2. Plus you can always customise existing code to fit your use case.

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.


Specific examples would be great as I am building a web app in Django right now that I hope will have a lot of untrusted users. Certainly I can point to examples of apps (such as http://disqus.com/) who use Django extensively and have lots of untrusted users.


Take a look at Pinax.


I just can`t understand why do you need to switch to the SAME technology? asp.net mvc is ok. all you will get, while switching to python or ruby, is lack of type system, generics, linq, f# power etc. it is big price, comparable to the development speed gain (???), cheap hosting (???), powerfull orm (???). If you want something really fresh, i think its better to take some no sql approach. or compose entire app on client with javascript. You can take all this modern things while using asp.net mvc. sory for my english.


If you are fluent in C# and are willing to put up with the license cost, you should go with ASP.Net MVC.

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.


Migrations aren't a particularly solved problem in .NET imo. (Bad previous experience with nhibernate and migrations of our team member made us skip it)

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.


If you don't want the hassle of dealing with deployment and don't mind going all out with JavaScript, which you will need to pick up anyway, then let me recommend a startup I'm helping out: http://www.akshell.com

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/


For building something that is content management, Django - as others have said - is a good choice. Going forward though, as a veteran C and web programmer I really like node.js. I think you will enjoy coding in JavaScript since it's like C syntactically, and you will really like the power and flexibility of node.js.

Also there are plenty of ORMs for node.js - I like Mongoose and mongodb personally, but there are several others.


From your experience, looks like Django will be a good bet for you. Try it out http://djangoproject.com


Or Ruby on Rails http://rubyonrails.org/ . . . but pick Django as Python > Ruby :P hides


http://railsforzombies.org/ is also fun if you have some spare time. Project-based video tutorials for Ruby on Rails.


I'd say learn Google App Engine's webapp framework.

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.


I'd say RoR is amazing quick to learn and use for other purposes. If one has any experience with REST, then most of the backend communication can be built out of scaffolding.

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.


I have a similar question which I asked over here:

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.


Use C: http://news.ycombinator.com/item?id=637676

(the article's gone, but there are some excerpts at http://gadgetopia.com/post/6839 )


This question gets asked time and time again (a few times a week on HN), and really, the only valid answer is "Try both & stick with the one you like best".

There are a plethora of right languages & frameworks. Try both & stick with the one you like best.



If you want a job, learn PHP or go C#. Keep the others as 'having some experience in'. C is still your best asset though, some operations done server-side will always need some C.


If you want a more exciting job, don't learn PHP or C#.

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.


That's not really the case, it just seems that way because of your local environment.

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.


Startup. Not looking for a job.

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 :-)


I spent the last 2 months building an app on rails and I've really enjoyed it. The available plugins and docs are great. With a bit more of a python background, I've really enjoyed Ruby. The ruby way of doing things seems more intuitive to me now, and I struggle a little bit when programming in python (not much, but I feel pythons stricter syntax and grammar to be a little bit of friction)

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.


CakePHP is nice and easy to learn, easier to deploy. It's not as trendy as RoR but there are a vast amount of easy to integrate PHP resources.


You're already familiar with ASP.NET MVC which takes a lot of its inspiration from Rails ... so yeah ... go with Rails.


others without the requirement to build a site can side-step the web and start with android. it's a cleaner model than the web that learned a lot from it. android xml files are far superior to anything css or javascipt.


Question: What would an ORM give you that LINQ can't?


i would say go for node.js because, 1.c style syntax 2.nodejs is itself evolving 3.you can learn serverside scripting 4.event based design 5.very good framework for deploying web apps




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: