5 ms·
>>Ability to write PHP code using the beautiful Haml templating system; >>Ability to write CSS stylesheets using the awesome Sass syntax [...]; >>Ability to wri
by yaix 15y ago
>>Ability to write PHP code using the beautiful Haml templating system;
>>Ability to write CSS stylesheets using the awesome Sass syntax [...];
>>Ability to write Javascript logic in Coffeescript;
Some may like that, but I want to write my PHP in PHP, and write my CSS in CSS, and write my JS in JS. I really never got why I would write one language in another language just to then use some tool to translate it (and if it gets a little complicated have to manually fix translation problems afterwards). Can someone explain please?
- tomkinstinch 15y agoI agree with you, but I think the claim is that for those familiar with language variants like these, it is possible to be more productive. It is, of course, also more difficult to find collaborators familiar with non-standard variant languages.
- bluesnowmonkey 15y agoHAML and SASS offer higher-level abstractions. They leak, but rarely enough that the cost of an occasional context switch (to debug generated code) is outweighed by normal productivity games. It's a good trade. You'll never need to doctor the generated code, by the way. Anything you'd want to do in HTML or CSS can be done in HAML or SASS.
- jablan 15y agoWell, you are not writing PHP, CSS and JS. You are writing an application (or a part of it), and these higher level languages allow you do that more efficiently, that's all.
- csomar 15y agoYou can still write in your favorite language and benefit from the routing engine for example, although it's not quite developed and rich.
- billpatrianakos 15y agoNo, I think you're wrong. It's not for everyone but I highly recommend you look into one of these. I'd say look at LESS or SASS (they're basically the same) because that's what I'm most experienced with. Here's why it makes sense to use these languages: First off, these languages help you write faster, and more efficiently. They mostly take a lot of the repetition and mental strain out of writing code. In my experience with LESS I'm always able to do things faster and don't have to remember color names or keep track of certain styles that I repeat many times especially if they include vendor prefixes. Then once you've "compiled" the code it's the same as if you were to write it normally. Some may say "so what's the point then?" but again I must repeat that you are able to work more efficiently and still have yourself normal, totally compatible CSS, js, or HTML. As far as performance goes, there really is no loss in performance as your abstracted code is compiled to the everyday kind with option to minify it too. I use LESS for all ky styling and on my Mac I use either Less.app or CodeKit which automatically detects changes to my .less files and compiles them on the fly to normal .css ones. The source of every page always asks for normal .css files and I really don't have to do any extra work besides making sure the app outputs my stylesheets in the right folder. As a bonus, CodeKit also minifies most languages, detects and syntax errors, and does some image optimization. On my Linux box, I just run a quick terminal command and the compiling takes a couple seconds. Barely any extra work at all. The only time I'd see ant performance issues is if you were doing client or server side parsing/compiling of these abstraction languages in production. For example, you can use less.js and have your .less files linked in your HTML and it'll turn it into CSS on the fly. That would be a problem. Otherwise, as long as you're taking your HAML, CoffeeScript, LESS/SASS/SCSS, and whatever else and converting it to everyday js, CSS, and HTML then you have nothing to lose and everything to gain. I used to believe like you that these superset languages were just a novelty and had no truly useful purpose. Then I tried LESS and still thought it was lame for a short time (I only grasped the concept of variables and thought the only benefit was being able to name colors) until I really understood it and now I can't live without it. Give one of these a try and I think you'll appreciate them. Edit: I understand that not all of these work the same. For those that require server or client side parsing with no option to convert prior to production then you have a point. But most of these abstracted, superset languages can be compiled to normal CSS/HTML/js before production and those are the ones that are truly beneficial.
- InclinedPlane 15y agoBy similar logic scala is useless since it just targets the JVM as does Java. Hell, why use Java at all when you could just write JVM bytecode by hand? Coffeescript, haml, and sass are useful because they reduce the complexity of coding html, css, and js. They allow you to get much more bang for your developer-hour buck. Why use jQuery when you can just talk to the DOM directly?
- rlander 15y ago"I really never got why I would write one language in another language" The terser the syntax, the less room for error in comparison to its more verbose counterpart. "just to then use some tool to translate it (and if it gets a little complicated have to manually fix translation problems afterwards)" If you're manually fixing compiled code, you are doing it wrong.
- wladimir 15y agoExactly, using higher level languages is a matter of DRY (Don't Repeat Yourself) and normalization (specify things in one place, have them change everywhere consistently). Especially for CSS this is really useful as in itself is a crude, low-level language, things can quickly become very verbose especially if you consider cross-browser compatibility for the fancier effects.