Ask HN: What web programming language do you use?

15 points by chrislomax ↗ HN
I have just read a really interesting post on how google+ is so fast, they use Closure.

Our team uses web forms in .net to perform our day to day functions.

Flame wars aside, what languages do you use and what have been your experiences with them? Also, what db do you use and how well has it scaled for your larger projects? What have you had to give up to use them?

Like I say, we use web forms and sql 2008. Although it is very easy to develop, I recently picked up MVC 3 and found that the extra control you have on the render is fantastic so I am left wondering what else I am missing out on.

I plan to give myself and another developer a new language to learn and possibly a new db if it fits to see where we plan to be in the next 5 years so any input is greatly appreciated. I am trying to avoid "buzz" languages and want to learn something that is going to stay around for a while.

31 comments

[ 5.8 ms ] story [ 72.2 ms ] thread
A language is mostly a tool to leverage the abilities of your team. I work best in a linux-based functional static typed environment, and I know OCaml well, so I use OCaml for web development. Other people are more productive in the Microsoft ecosystem with an IDE-powered, object-oriented approach, and that is what they should use.

I just tried various environments (Node.js, naked PHP, PHP-ZF, some ASP.NET, naked OCaml, OCaml-Ocsigen-Eliom...) before it became clear that one of them was best suited to the way my mind works. If you're interested, I could go into more detail about that.

I'd like you to elaborate if you wouldn't mind?

The languages that interest me at current are node.js, closure and i'm even looking at python.

My mind does work in a few ways to be honest, i've developed in a few languages growing up so I have had mixed experience.

We manage our own servers so there is no reason we cannot virtualise them and put Linux on them as well as IIS. We are taking the mindset now that we use the best technology for the job rather than fitting the technology to the job

I am utterly incompetent when it comes to inventing a good design. Almost every single module I designed has had its interface rewritten. In many cases, there have been several rewrites of the same interface because I did not manage to get a good design going even on my second, third or fourth attempt. Mind you, after two or three rewrites, I end up awesome APIs.

So, I need a tool that helps me rewrite modules as easily as possible.

One limitation is my words-per-minute figure. A language that is short, in the sense that very little code is required to get things going, is a good thing. Javascript and OCaml qualify, but Java, C# and PHP do not because of the boilerplate involved in many operations. I guess the latest versions of C#, with lambdas and type inference, are becoming acceptable.

Another limitation is the risk of getting something wrong, and the only solution so far is having a good automated testing suite. In every programming environment, there is a sweet spot to be found between too little automated testing (you waste a lot of time hunting for bugs) and too much automated testing (you waste a lot of time writing or re-writing tests), and what matters to me is how efficient that sweet spot is. For instance, Java/C#/OCaml provide me with "undefined variable" detection for free (just compile the thing) but Javascript and PHP do not.

When written in a pure functional exception-less style, OCaml detects almost all major classes of errors simply because of its type system. Many of these would require unit tests with complete code coverage in languages like PHP or Javascript (such as calling a member function that does not exist) or Java or C# (such as preventing Null Reference errors) and some of them cannot even be verified with unit testing at all (such as forgetting to check that you are allowed to do X before doing X). In fact, I suspect the automated testing sweet spot in OCaml is precisely to have no unit tests, except for dealing with external APIs or very complex logic (regular expressions...)

Not everyone can write pure functional exception-less OCaml (or do so happily for ten hours every day), but I can. As a result, I decide on the first design that seems to be compatible with the requirements, and perform at least one or two major design changes every week. These changes involve changes to at least 5-10% of the code base (with the odd 60%) but seldom take more than an hour to perform, and so far the automated testing has caught all the errors that cropped up.

Thanks for taking the time, I have never heard of OCaml to be honest.

This was the purpose of this question though and so far it's inspired some good results

There will come a time when we take a massive leap of faith and change completely how we work but I don't want to jump in.

I will take a look at OCaml and see if it suits our needs as a company

Thanks again

Since you come from a .NET background, you can take a look at F#: it is based on OCaml, but fully integrated with the entire Microsoft stack. Most of the compile-time checking benefits of OCaml apply to F# as well.
I'm using play framework, with Java and trying Scala with it. Recently JetBrains announced support for play framework in next IntelliJ IDEA 11, I've installed Early Access version and so far it looks great.
Same here, only using it all with pure Java, git and vim. Probably the greatest web framework I've ever used.
A little offtopic: where do you plan to deploy it? I plan do deploy my app to a servlet container.
What DB are you using with it?

How does speed measure up?

When I deploy I'm using MySQL, the development speed is ok, and pages load quickly, but the site have not been tested under high load.
At work we use PHP via CakePHP. At home I use Ruby, depending on the project via Sinatra or Rails. I'd really like to pick up something like Haskell or OCaml, but they seem so alien to me!

All fan-boyism aside I've found Ruby/Rails/Sinatra to be much more pleasurable than writing PHP/CakePHP. I can write code clearer and faster than I do at work. Now a good part of this is the fact that I'm not very passionate about what I do at my day job also.

Well I fell out with PHP about 3 years ago and moved to .net.

It's hard to get a real perspective on what is the best language to use, there have been rumours rails is over the hill now but it's just what I read around the web. I suppose this is my main reason for asking this question!

Caution, Closure != Clojure
Just to clarify, "Closure" isn't a language itself, it's a set of JavaScript and Java libraries for web development. It's easy to mix up with "Clojure", a general purpose Lisp-like language (that runs on the JVM, CLR, and JS).
Well I did think this originally until I went to the actual site for it. I am interested in the language though
If you are looking for a new web framework and new database that will last you for 5 years, you're better off sticking with something mature.

I'm a bit biased, since I went from .NET to Ruby on Rails, but I realize that RoR may not have the 5 year shelf life you are looking for.

Honestly there are so many changes going in the web world, you are better off experimenting with a few and then deciding. Its impossible to say who will be on top in 2017. Its highly likely that the hot framework of 2017 doesn't exist today.

I would look at RoR, Play 2.0 with Scala, Django, and ExpressJS with Node. For front end stuff look at Backbone.

On the database side, stick with relational by default but experiment with NoSql solutions for non-critical data storage (logs, write once activity streams, etc). Get understanding of the persistence mechanisms and gotchas before fully committing.

Good luck!

Well another dev and myself just had this exact same conversation. There is a lot changing and I see a new technology on Hacker News every day. To be honest, the main reason to look around is because there is so much change happening.

I don't believe .net is the best for us, we use it because we have so much written in it and our libraries are very large.

I am currently looking at NoSQL, Mongo seems to be the one we are favouring at the minute.

The one thing that really makes me want to experiment is knowing that sites like Facebook use multiple technologies to run the site and that's how I want to be.

I currently feel stagnant and trying to make our projects fit into .net.

I appreciate your comment

I think a good strategy to insulate yourself from .NET is to slowly move your .NET code into RESTful services and isolate the dependencies there.

The one big downside is that most of the alternatives are designed to work better with Unix based systems. That's usually a much bigger pill to swallow for an all Windows .NET shop so YMMV with pushing that.

I know a shop trying to do Node.JS on IIS so that may be an option worth looking into to see if it works. YMMV here too, because it's really bleeding edge right now.

Well I was aware of the IIS node.js plug-in. I am really interested in node.js as well.

It may be worth like you say putting it into a service that we could consume from many languages and taking it from there. Our main issue really is our admin as it relies quite heavy ContentPlaceholders as we populate them on runtime but I am more interested right now in trying new technologies

Java: JSP, GWT, SmartGWT, Play! Ruby: Rails, Sinatra Clojure: Compojure, sometimes with Noir + Compojure Common Lisp: portable aserve with Dojo

I would suggest using any non-proprietary framework and language you feel comfortable with. As a consultant, I choose whatever my customer wants, and for my own projects I choose languages and frameworks that I most enjoy using.

Well currently we guide the customer. We can knock out a brochure site in around 2 days on our system so we don't want to lose that. We just want to make everything faster and try to steer away from lining Microsoft's pockets every ten minutes.

VS2010 was a disaster of a product in my eyes and instead of fixing it they just released another 1. Which of course we have to pay out for again.

I don't mind paying for a product, if they fix the bugs in the one you currently have!

We primarily use Java on Jetty, utilizing Apache Wicket as a rendering engine, with custom( non-jquery/prototype )javascript. Our DBMS is PostgreSQL, but this is immaterial to the web applications, because they acquire their data and perform service calls via REST, and handle cache invalidation through a MQ. The customer-facing applications themselves never talk directly to the database.
Your data is provided through rest but what are you using for providing the rest platform?

Do you see no compromise in speed not talking directly to the db?

For small applications I can see the advantage but I have customers with 1 million products?

We also use Java/Jetty with raw servlets, a custom DSL, and JDOM for the REST endpoints.

As for performance, our customer-facing sites are quite a bit faster then a typical DB-coupled site because page objects are fetched from a local memory cache that is invalidated by MQ processing.

Our application is not small, but not large, either. For a large application, Amazon.com is well-known for also using a SOA architecture to deliver customer-facing sites, none of which directly call the DB.

Thanks for the feedback.

I think the first port of call for us, like other have mentioned also, is to look at the RESTful interface.

I have been looking and we can quite easily translate a lot of our current code into WCF rest endpoints which leverage caching and you can put sql dependencies on them which means we don't have to re-work a lot.

I am going to look at putting 64gb ram into our db server so we can confidently store a lot more of the db in ram cache.

We currently cache at web server level which we were moving to network caching anyway so this move is not putting us out, if you will.

This appears to give us the chance to move our front end to a different language. This also gives us the chance to play with different language using our real time data

Our success in the coming years will be defined by the decisions I make in the next two weeks so I appreciate the comments you have made

In case anyone is interested, here is the route we are going to take for tests.

We are going to look at node.js, ROR and Closure.

We are also going to look at abstracting our our business logic to RESTful services on the top of WCF. This gives us a chance to use existing code but put it into an API.

We are also going to take a look at MongoDB.

I appreciate everyone who commented and we have not dismissed other ideas, these are just our first port of call.