10

When I think of pretty much any programming language - like C, C++, PHP, SQL, JavaScript, Python, ActionScript, Haskell, Lua, Lisp, Java, etc - I'm like awesome I would love to develop a computer application using any of those languages.

But when I think of web frameworks(I do mostly PHP) - like Cake, CI, Symfony, Laravel, Zend, Drupal, Joomla, Wordpress, Rails, Django, etc - I'm like god no.

Why aren't there web frameworks that provide me with simple, fun and powerful constructs like a programming language?

6
  • 2
    "I'm like awesome I would love to develop a computer application using any of those languages." And are you master of any of those languages? Because anyone who knows what they are doing will tell you no language is elegant or fun. They are just tools to achieve your goals, and as tools have their problems and flaws.
    – Euphoric
    Oct 13, 2013 at 7:14
  • 14
    @Euphoric With 10 years of experience, I disagree. Some languages are fun to work with; others are a pain. And there are some well-designed ones that are elegant, as well. However, I do agree that they all have their own problems.
    – Izkata
    Oct 13, 2013 at 7:18
  • @Izkata 10 years with every one of them?
    – Euphoric
    Oct 13, 2013 at 7:21
  • 5
    @Euphoric About 10 years in a handful of languages, but all of fairly different types (on the order of C versus Javascript), and about 3 years of a whole bunch more. I've used a third of the ones mentioned in the question, and many more not mentioned (including my favorite, Rebol). For me, for example, Javascript and Rebol are "fun" languages, while Rebol and Lisp are "elegant" (and I've heard Haskell is, too, but I don't know it). If you use a language enough, and run up against its strengths and weaknesses, these "fun" and "elegant" opinions quickly form on their own.
    – Izkata
    Oct 13, 2013 at 7:28
  • 4
    The number of fundamental, atomic concepts in a programming language is small and easy to comprehend, therefore it's easy to build elegant tools around such concepts. The number of irreducible concepts required to operate the simplest web interaction is a way much bigger. Complex problems are unavoidably producing complex, ugly solutions.
    – SK-logic
    Oct 13, 2013 at 7:36

4 Answers 4

19

I had this question for years too, even though I am on Python side. I do not have a single explanation for this phenomenon, but here are my thoughts on the subject:

  • Web-frameworks must deal with XMLish markup language - HTML, part of the current web-triad HTML-CSS-JavaScript in a client-server way. It means three languages, which interact with each other, a browser DOM and execution model (and security model). In effect, each piece of functionality (a "module") should have its code in all three languages. To add to this, jQuery's selector language is becoming one more language to care of.

  • HTML+CSS lacks intuiitive and mathematically sound model for placing objects. Even Tcl/Tk is IMHO better at defining geometry managers. This prevents programmer from defining HTML rendering in strict terms and rely on the luck instead: "maybe this div will work most of the time in most of the browsers". There are some positive developments on this side though, for example, HTML5 and Twitter Bootstrap.

  • Web technology has grown organically and frameworks has grown with it, so their shape is not necessary elegant. It means programmer should remember the APIs, which are suboptimal, going to be deprecated, and so on

  • Web browsers do still have slight incompatibilities, and it adds unnecessary complexity to web-frameworks

  • The overall architecture is a mess. It's a split-thinking of back-end and frontend, which are tied together with request/response on backend side and data-driven rendering on front-end side. Order of execution is not very well-defined (synchronisation requires effort) and placing styles, scripts to proper slots is required (almost all js scripts need to be placed before the end of body tag, and so on). Caching is yet another aspect, which spans from backend to proxy(ies) to front-end. And I do not even mention form-handling!

  • Web-framework necessarily deals with most of these complexities by adding a lot of concepts and processing pipes.

  • In web industry labour is usually divided between graphics designer, web designer/web programmer and backend programmer as a minimum set of roles. The former two do not necessarily have programming skills, so they need a different abstractions and tools, and frameworks should facilitate them too

In summary, web frameworks try to abstract a lot of complexity (growing complex themselves), but it is very hard to achieve due to rapid development of standards and other moving parts. Programming languages are much more mature, because it is usually not a problem not to use new features.

I think, making convenient web-framework will be possible only after GUI standards will be in place (covering different modes of operation, such as mobile devices) and the underlying technologies will be stable enough.

Web-frameworks lack simple constructs because there are no such things in the web-technology domain. Lower-level abstractions necessarily leak to higher level.

3

I think a lot of it has to do with the limitations of the WWW. Specifically, there's no built in way to store state between the server and client. A client requests some data, the server provides it and the connection is closed. As such, all of these web platforms have to put together their own method of keeping state between server calls.

I had to make a small web app once and at the time I'd never done any server/client programming. It took me a few weeks to figure it all out and the hardest part was trying to get my head around keeping track of where the client and server were at.

Will this ever change? I doubt it. It would require a fundamental change in the architecture of the web.

2

Generally speaking, the causes might be multiple:

  1. The abstraction gap is larger in the framework case. A modern procedural/OOP language provides abstraction over a machine but keeps some machine constructs (such as assigning a variable some data / writing some data in a memory unit, or calling a procedure etc.); the gap is not that big, while a framework tries to provide abstraction for developing a web application which operates with much more concepts.
  2. Frameworks can be more complex from the programmer's point of view; this is like a consequence of the first point. A programming language is rather simple, it has simple constructs (if, for, variables, procedures etc.). Also the standard library abstracts simple things like writing to IO, or using collections. The standard library it is also very modularized, with few or no connection between on module with another; you do not need to know IO to use collections or vice-versa. To be noted that if some parts of the standard library are rather complex, they are placed in a mini-framework (e.g. Java Collections Framework or Executors framework). In the framework case you kind of need to know the whole flow, all the parts in order to use the framework at it's full strength. Also, a a framework is an already built application; a programmer only needs to customize certain parts but s/he needs to know the application first, what it does.
  3. Not so many resources are put in a framework as in a programming language. I believe this does not need any explaining.
0

Ah, but you see that is exactly the problem. Frameworks are not supposed to be Turing complete. They are supposed to be composed of more restricted abstractions that can be composed together to perform a specific set of tasks in a succinct manner. So all those frameworks you mentioned are no fun exactly because they don't provide a restricted set of abstractions. They provide leaky abstractions than in and of themselves compose an abstract machine that is more than likely Turing complete. The concept of "weird machines" is the closest thing I'm thinking of. All those frameworks are "weird machines" for web applications and a "weird machine" is the opposite of what a framework should be.

1
  • 1
    I'm giving +1 because despite the rambling nature of the post, it is right in that frameworks aren't necessarily Turing-complete. That's one of the draws of a complete general-purpose language, the ability to do anything if you know how.
    – Izkata
    Oct 13, 2013 at 7:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.