Ask HN: Web programming for a C++ server developer?
4 comments
I went through that jump about a year back, so here are some of the things that I've gleaned:
- You'll be doing a lot of JS. Just use jQuery. It's the most popular of the JS / AJAX frameworks, so even if you decide not to use it later on, it's a good starting point.
- I dig Ruby / Sinatra. Never really got into Rails or Django. You can learn how to use Sinatra + Haml + Sass in a few minutes. I've also learned that, somewhat to my surprise given my previous perception of their fan-bases that I don't really like Python and much prefer Ruby.
- For novelty there's Wt (http://www.webtoolkit.eu/wt), haven't brought myself to actually use it for anything though.
- CSS grid layout "frameworks" make things easier. I used (http://code.google.com/p/blueprintcss/) for our new site, but can't say that I had much love for it -- though still much better than doing all of the layout by hand.
- You'll be doing a lot of JS. Just use jQuery. It's the most popular of the JS / AJAX frameworks, so even if you decide not to use it later on, it's a good starting point.
- I dig Ruby / Sinatra. Never really got into Rails or Django. You can learn how to use Sinatra + Haml + Sass in a few minutes. I've also learned that, somewhat to my surprise given my previous perception of their fan-bases that I don't really like Python and much prefer Ruby.
- For novelty there's Wt (http://www.webtoolkit.eu/wt), haven't brought myself to actually use it for anything though.
- CSS grid layout "frameworks" make things easier. I used (http://code.google.com/p/blueprintcss/) for our new site, but can't say that I had much love for it -- though still much better than doing all of the layout by hand.
What specifically about Ruby leads you to prefer it over Python? Are there better/more modules or is the language itself more expressive or powerful in some way?
Also, was there a specific reason you chose Sinatra over Rails? I'm not familiar enough with either to make an informed decision so it would be interesting to hear others opinions.
Also, was there a specific reason you chose Sinatra over Rails? I'm not familiar enough with either to make an informed decision so it would be interesting to hear others opinions.
As to ruby or python, I think its a matter of taste. Both are powerful enough.
Coming from C++, Rails might drive you nuts. I like to be certain of what my code is doing. To achieve this with Rails, you either have to: 1 - write _loads_ of tests or 2 - dig through Rails source to ensure the DSL does precisely what you think it does. You don't want option 2 as Rails source is a nightmare. Option 1 may not fit your sensibilities if you're used to writing defensive code and writing too many tests seems a waste of time.
I can't speak for digging through Django source nor can I speak for how clearly documented the DSL-like things are.
If you want more control over your app behavior or simply see what's going on easier, the python world has webpy and cherrypy. The Ruby world has sinatra. Something in between Rails and sinatra is merb.
Coming from C++, Rails might drive you nuts. I like to be certain of what my code is doing. To achieve this with Rails, you either have to: 1 - write _loads_ of tests or 2 - dig through Rails source to ensure the DSL does precisely what you think it does. You don't want option 2 as Rails source is a nightmare. Option 1 may not fit your sensibilities if you're used to writing defensive code and writing too many tests seems a waste of time.
I can't speak for digging through Django source nor can I speak for how clearly documented the DSL-like things are.
If you want more control over your app behavior or simply see what's going on easier, the python world has webpy and cherrypy. The Ruby world has sinatra. Something in between Rails and sinatra is merb.
In general, Django is considerably more explicit about what it's doing (particularly after the "magic-removal" branch two years ago). The implicit trade-off is that some things that Rails does automatically you have to declare explicitly in Django, but it hits the sweet spot for me.
My understanding is that Rails has trended that way lately, but since I don't use it day-to-day I can't say whether that's the case.
I can't compare the Django source to Rails, having never really read the latter, but on its own it's pretty good. Like any large-enough pile of code, there are ups and downs, but whenever I've had to dig in and understand what's going on, it's been fairly straightforward to follow.
My understanding is that Rails has trended that way lately, but since I don't use it day-to-day I can't say whether that's the case.
I can't compare the Django source to Rails, having never really read the latter, but on its own it's pretty good. Like any large-enough pile of code, there are ups and downs, but whenever I've had to dig in and understand what's going on, it's been fairly straightforward to follow.
Rails has certainly become loads better. But the source is still cryptic to anyone but a ruby master. Rails 3 is in the works which is turning into mostly a full rewrite as near as I can tell. I expect Rails 3 code base to be much easier to understand. But that's not out yet and when it is, I expect you'll need to wait a year before enough of the libs and plugins are running smoothly.
It sounds like you have enough python under your belt and like django well enough. I'd recommend going with that. Your not missing out on some other framework/language pair that is more powerful.
I use ruby/merb. I occasionally look around for something I like better but nothing is worth the switching costs at this point.
It sounds like you have enough python under your belt and like django well enough. I'd recommend going with that. Your not missing out on some other framework/language pair that is more powerful.
I use ruby/merb. I occasionally look around for something I like better but nothing is worth the switching costs at this point.
[deleted]
Python's object system really feels like it was an afterthought and its standard libraries are comparatively messy. The object systems feels a lot like using opaque types in C -- the notion of objects is a relatively thin, rather than deep abstractive mechanism. It also feels to me like it's overly explicit in the wrong places and lacking syntactic sugar in obvious places.
I like Sinatra partly since we were building apps on our own (non-SQL) database and partly because there just wasn't much to learn. I like things that I can work with progressively rather than having to invest a bit of time in up front to get started.
(My opinions on PHP, Python and Ruby were all formed relatively recently as I learned each of them to write the language bindings for our webservices API.)
I like Sinatra partly since we were building apps on our own (non-SQL) database and partly because there just wasn't much to learn. I like things that I can work with progressively rather than having to invest a bit of time in up front to get started.
(My opinions on PHP, Python and Ruby were all formed relatively recently as I learned each of them to write the language bindings for our webservices API.)
I think you will basically have the same programming experience with any one of Perl, Python, or Ruby. It is a matter of personal taste, really.
Uh no.
Perl is horrible. It basically showed us that python/ruby languages were possible, but is horrible, and lots of legacy code it in is often horrible.
Perl is horrible. It basically showed us that python/ruby languages were possible, but is horrible, and lots of legacy code it in is often horrible.
Horrible code is horrible. That has nothing to do with Perl.
There is indeed a lot of terrible Perl in existence. But new Perl code is quite nice I can use two modules and reasonably assume that they don't both make conflicting changes to the global class hierarchy. In Ruby... not so much, at least if you are using Rails.
Did you know that Perl 5 looks like this now?
http://blog.jrock.us/articles/Multimethods.pod
There is indeed a lot of terrible Perl in existence. But new Perl code is quite nice I can use two modules and reasonably assume that they don't both make conflicting changes to the global class hierarchy. In Ruby... not so much, at least if you are using Rails.
Did you know that Perl 5 looks like this now?
http://blog.jrock.us/articles/Multimethods.pod
Visual basic CAN look nice. Its just the vast quantity of it doesn't.
You are picking the people you're programming with when you pick a language. Lots of people do very dirty dirty things in perl, and while those exist in Ruby and Python as well, proportionately they are much fewer in number there.
You are picking the people you're programming with when you pick a language. Lots of people do very dirty dirty things in perl, and while those exist in Ruby and Python as well, proportionately they are much fewer in number there.
Blah, bad editing. Insert a period between "quite nice" and "I can".
Ruby is cooler, python is cleaner.
Rails is the bomb, except when you need to scale, or something is wrong.
Python by far has more modules, and ties into C easiler (and C++ via weave).
Rails is the bomb, except when you need to scale, or something is wrong.
Python by far has more modules, and ties into C easiler (and C++ via weave).
I've had few problems scaling my Rails site up to over 2M requests per day. The "Rails can't scale" stuff is a myth. Good code, with proper techniques goes a long way.
"Rails is the bomb, except"...
...when you need to dig into the Rails source to figure out what's going on. You really need to fully master Ruby to be able to grok Rails source well.
I think both languages have easy enough C binding.
...when you need to dig into the Rails source to figure out what's going on. You really need to fully master Ruby to be able to grok Rails source well.
I think both languages have easy enough C binding.
> I've been programming low-latency, high throughput C++ systems for more than 5 years now
You will cringe at the web stuff then. Lots and lots of CPU cycles are wasted to shorten the development cycle and simplify (dumb down) the life of the developers. Layers upon layers of abstraction. Using PHP to generate a static HTML page is not a big deal. This sort of thing.
It certainly makes a lot of business sense as the hardware is cheap, and the labor is not. But if you are used to squeezing every last drop of performance from you code, it will be painful to look at some of the web stuff.
You will cringe at the web stuff then. Lots and lots of CPU cycles are wasted to shorten the development cycle and simplify (dumb down) the life of the developers. Layers upon layers of abstraction. Using PHP to generate a static HTML page is not a big deal. This sort of thing.
It certainly makes a lot of business sense as the hardware is cheap, and the labor is not. But if you are used to squeezing every last drop of performance from you code, it will be painful to look at some of the web stuff.
I'm in the same situation. I've never really written a DB-backed web-based application, so I'm starting down that road. Been working mostly on C++ distributed multi-threaded servers with lots of asynchronous network communication.
I'm a big Perl fan and am comfortable with its object-oriented model so I've chosen to use it. Here's the environment/tools I've settled on so far: Apache on Linux (primary platform, might try to make sure works on Windows too); mod_perl 2 in Apache pre-fork; PostgreSQL 8.x for back-end; Rose::DB for DB persistence layer (apparently easy-to-use ORM, allows many-to-many relations unlike various other Perl-based DB layers); Template-Toolkit 2 for web template environment; going to layer on JavaScript later ... not sure which library to use yet.
To some this may not be the ideal environment or the most current or most up-to-date set of tools. For me though it seems the quickest way to seriously explore and understand web issues.
I have a big hole in my software experience where several web apps should be, and I need to fill it with something. Might try Django or some other Python tool later. I'd actually like to try Twisted some time (asynch Python network engine, not web-specific).
I'm a big Perl fan and am comfortable with its object-oriented model so I've chosen to use it. Here's the environment/tools I've settled on so far: Apache on Linux (primary platform, might try to make sure works on Windows too); mod_perl 2 in Apache pre-fork; PostgreSQL 8.x for back-end; Rose::DB for DB persistence layer (apparently easy-to-use ORM, allows many-to-many relations unlike various other Perl-based DB layers); Template-Toolkit 2 for web template environment; going to layer on JavaScript later ... not sure which library to use yet.
To some this may not be the ideal environment or the most current or most up-to-date set of tools. For me though it seems the quickest way to seriously explore and understand web issues.
I have a big hole in my software experience where several web apps should be, and I need to fill it with something. Might try Django or some other Python tool later. I'd actually like to try Twisted some time (asynch Python network engine, not web-specific).
Coming from C++, if you do not want to become crazy using untyped languages you might be interested by the haxe programming language.
A nice inference typed language which can be compiled down to neko bytecode (much like java bytecode), JavaScript (for the client side), Flash movies (idem), and even C++
Plus, haxe has a mod_neko for apache and lot of libraries to manipulate databases and templates.
http://www.haxe.org
A nice inference typed language which can be compiled down to neko bytecode (much like java bytecode), JavaScript (for the client side), Flash movies (idem), and even C++
Plus, haxe has a mod_neko for apache and lot of libraries to manipulate databases and templates.
http://www.haxe.org
I've started to implement my site using Django as I'm a moderately proficient Python programmer but would be open to switching to another framework for a compelling reason. Also, where can I find resources to learn the more client facing stuff (AJAX, CSS, basic layout and design, etc)?
As an aside, has anyone else been through this before (i.e. much more comfortable with back end work but want to implement an idea you've had)? What did you do in that situation?