Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming

Zen Coding 175

Download Squad has a quick review, with video, of Zen Coding (Google Code project page here), an extremely well-thought-out accelerator for anyone who codes HTML. Its syntax is CSS-like. Zen Coding has been around for a while — here's its author Sergey Chikuyonok's introduction in Smashing Magazine from last November — and it has now picked up support for more than a dozen editing environments, including Notepad++ and TextMate.
This discussion has been archived. No new comments can be posted.

Zen Coding

Comments Filter:
  • Vim? (Score:3, Informative)

    by 19061969 ( 939279 ) on Sunday May 02, 2010 @09:54PM (#32068752)
    There doesn't appear to be support for Vim but that already has another script called snipMate http://www.vim.org/scripts/script.php?script_id=2540 [vim.org]
  • by MoFoQ ( 584566 ) on Sunday May 02, 2010 @09:56PM (#32068764)

    don't mock the Notepad++....it's very powerful, yet lightweight and unbloated.

    I'm sure many slashdotters here also live by the "Notepad++ code"....

    • yea...Ctrl-D is very useful.
      So is Ctrl-T
      Tab and Shift-Tab for formatting.

      Also like "nano" but I still prefer N++ since it's got syntax highlighting, support for tab-formatting AND tabs....etc.

    • Re: (Score:3, Funny)

      by wmbetts ( 1306001 )
      Vim > emacs > Notepad++ Let the war begin!
    • Re: (Score:3, Interesting)

      by gfody ( 514448 )
      I prefer emEditor [emeditor.com]
      • Re: (Score:2, Informative)

        by MoFoQ ( 584566 )

        emEditor isn't open source let alone a $0 software

        • Re: (Score:3, Insightful)

          by EvanED ( 569694 )

          Yeah, god forbid someone pay money for software they use and like.

          • by bit01 ( 644603 ) on Monday May 03, 2010 @03:45AM (#32070192)

            Yeah, god forbid someone pay money for software they use and like.

            The price and license are important software characteristics whether you like it or not. A non-zero price can make it a practical impossibility to use in many organizations because of the paperwork involved. A license that doesn't allow you to install it where ever you need it, as you need it can also be a problem.

            Since their are many free alternatives available in this category it's easily possible that the pay software is more trouble than it's worth even if it is otherwise superior, as the GPP was implicitly pointing out.

            ---

            Like software, intellectual property law is a product of the mind, and can be anything we want it to be. Let's get it right.

            • Re: (Score:2, Interesting)

              by EvanED ( 569694 )

              A non-zero price can make it a practical impossibility to use in many organizations because of the paperwork involved.

              But not always, and definitely isn't at home.

              Since their are many free alternatives available in this category it's easily possible that the pay software is more trouble than it's worth even if it is otherwise superior, as the GPP was implicitly pointing out.

              And apparently that's not true for the poster who originally mentioned it.

    • I heart that program. Only thing I don't like about it is its updater. It sometimes complains taht there's a new version, and when I say, "OK, do the update", it doesn't work. I end up just icing the old one and downloading and installing the new one manually.
  • It's a specialized Lisp REPL, or something like it.

  • Zen (Score:5, Insightful)

    by mindbrane ( 1548037 ) on Sunday May 02, 2010 @10:08PM (#32068826) Journal
    Is there a better commentary on the west's general inability to grok zen than our endless bastardization of the word, zen?
    • Re:Zen (Score:5, Funny)

      by istartedi ( 132515 ) on Sunday May 02, 2010 @10:22PM (#32068922) Journal

      Is there a better commentary on the west's general inability to grok zen than our endless bastardization of the word, zen?

      ZEN is not a ticker symbol on the NYSE yet, so I guess not.

      • by bl8n8r ( 649187 )

        > ZEN is not a ticker symbol on the NYSE yet, so I guess not.

        Not so fast, have you checked with the USPTO?

    • Re: (Score:3, Funny)

      by fractoid ( 1076465 )

      Is there a better commentary on the west's general inability to grok zen than our endless bastardization of the word, zen?

      That's so ironic. *ducks*

      • Re: (Score:3, Informative)

        by Anonymous Coward
        Zen came to fruition the Tang Dynasty, at the height of development of Buddhism in China. It came as the highest practice, equivalent to Indian Prajnaparamita and Tibetan Dzogchen or Mahamudra traditions. The people who practiced it were those who already had great meditative ability and high capacity for understanding. Without a solid foundation, studying Zen (especially in the West) is simply nonsense. Without a background in the Buddhist sutras, you will likely just become confused or fool yourself into
        • Re: (Score:2, Insightful)

          by Anonymous Coward

          It's mysticism, so it doesn't matter how "serious" you try to be, It's still dressed-up psychobabble in the vein of similar New Age practices. Just because it's old, doesn't mean it should automatically get belief or respect (see also: Christianity, Islam).

          • Isn't the only reason it's still mysticism is because there currently isn't enough neurological evidence about what meditation does to the brain?

        • On the contrary. Just sit.

          Zen is not about study. It's about practice.
        • by IICV ( 652597 )

          Without a background in the Buddhist sutras, you will likely just become confused or fool yourself into thinking it's just a mind game.

          So what you're saying is, it takes lots of training to convince yourself it's not just a mind game? Kind of like the Trinity, I suppose.

    • Re: (Score:3, Insightful)

      by chill ( 34294 )

      The wise programmer is told about Tao and follows it. The average programmer is told about Tao and searches for it. The foolish programmer is told about Tao and laughs at it.

      • by goombah99 ( 560566 ) on Monday May 03, 2010 @12:42AM (#32069496)

        The master told me to mediate on the sound of one parenthesis closing. I am ashamed that I don't know what this means. Or was that his point.

        • The master told me to mediate on the sound of one parenthesis closing. I am ashamed that I don't know what this means. Or was that his point.

          The sound of one parenthesis closing depends on which error WAV file does you editor play when it finds no opening parenthesis.

        • by lennier ( 44736 )

          Mmm, stack underflow.

          Sounds like a crispy crackling burning noise.

      • by jo42 ( 227475 )

        The Real Programmer knows it's all a bunch of BS and does whatever it takes to get the job done.

    • Re: (Score:2, Informative)

      by tpstigers ( 1075021 )
      The word zen means 'meditation'. Not real hard to grok. Nor is it difficult to understand why someone would consider coding to be a meditative process. Or were you actually referring to Zen?
    • Re: (Score:3, Interesting)

      by Hurricane78 ( 562437 )

      Actually, I agreed with you, in having been ignorant about anything but the romantic western views on “zen”.
      So I read up on the actual philosophies behind it. And now I just as much won’t to come near zen, as I don’t want to come near any other religious insanities. (Please bear with me. Or at least read the points, down there where it’s marked bold. Thank you. :)

      See, the goal of Zen, as far as I see, is so get into a “total zero” state. One that they call “en

      • I don't know what you have read, but you do not understand Zen. Satori is not a "total zero" state. It is what you experience when you suddenly realise that you have spent a whole day coding without distraction, that you have never been conscious of thinking about what you are doing, and the compiled program just works. Or when you realise that you have just driven from London to Birmingham (or your local equivalent) without ever thinking about it: it just happened. Satori is the state when you are "just do
      • Sorry, but its clear to me that you don't really know much about Zen.

        Which books did you read? There is a very large conceptual/language barrier that causes many westerners to misinterpret or get confused over what Zen is about.

        We can't expect everyone to know about all other concepts in the world, but surely we should know about such limitations and not spread FUD about something we aren't familiar with?

    • by aaandre ( 526056 )

      Too trendy. Bastards will have their way with it and there's nothing you can do.

  • by Anonymous Coward on Sunday May 02, 2010 @10:09PM (#32068838)

    such as:

    * What is the sound of one interrupt flapping?
    * If an exception gets thrown in an operating system, and no one is around to catch it, does it make a sound?

  • Let's see... (Score:5, Insightful)

    by oljanx ( 1318801 ) on Sunday May 02, 2010 @10:31PM (#32068960)
    When I "write HTML" I'm actually writing HTML, CSS, JavaScript, PHP and SQL queries at the same time. On a good day. What the hell, why not add another syntax?
    • Re:Let's see... (Score:5, Insightful)

      by pavera ( 320634 ) on Sunday May 02, 2010 @10:44PM (#32069008) Homepage Journal

      Please keep your SQL and HTML separate. Don't punish those who will come after you.

      • Please keep your SQL and HTML separate. Don't punish those who will come after you.

        Now where's the fun in that?

      • Re:Let's see... (Score:5, Interesting)

        by eelke_klein ( 676038 ) on Monday May 03, 2010 @12:31AM (#32069442)

        Maybe you should make that, please keep your SQL, PHP, JavaScript, CSS and HTML seperate.

        • They didn't actually say they were all in the same file.

        • Re: (Score:3, Insightful)

          by slimjim8094 ( 941042 )

          How do you suggest separating PHP, HTML, and JS? Sure, the bulk of your code - especially reused libraries - should be separate but how do you use them without inline JS? And if you're using PHP, what are you using it for if not writing HTML (with the aforementioned JS)? Your PHP, even if it calls stored procedures, will also have SQL in it - and do you really need a stored proc for every one-shot thing? Repeated code, sure, but... And do you make one-shot CSS classes or blocks for everything?

          Half of what y

          • Re: (Score:3, Informative)

            by hgavin ( 259102 )

            how do you use them without inline JS?

            http://en.wikipedia.org/wiki/Unobtrusive_JavaScript [wikipedia.org]

          • Re: (Score:3, Informative)

            by FredMenace ( 835698 )

            It is trivial to have not a singe line of Javascript in your HTML, other than the link to the external Javascript file.

            See, for instance, http://api.jquery.com/category/events/ [jquery.com] for a set of jQuery methods for attaching events, using css-like selectors. (Most of these methods are special cases of "bind".)

            To avoid mixing HTML and PHP, you can use a templating engine like Smarty (http://www.smarty.net/crashcourse.php). (I prefer those that use a different syntax from regular PHP to help enforce the distinction

          • by Gulthek ( 12570 )

            Wow. Ok. I'm a web developer by trade, so let's break this down from lowest hanging fruit on up:

            JS: separating JS from HTML is supremely trivial. Rather than enclosing your JS in js code, call out to a source file: . If you doing funky old school coding like using onload, replace that with a good JavaScript library and events (jQuery is my preferred flavor, but they're all good.)

            PHP: think of it like this: there are essentially two key actions your PHP is responsible for: getting data and building a display

        • And keep your actual content out of any of those. (Or you will be punished with problems with translations and others. :)
          I preferred to keep content in custom XML formats individualized for the actual content. But nowadays, I have my own lightweight binary (EBML-like) markup format, which, with a tag mapper information file or block, is just as easy, but (other than XML) very efficient.

      • I think you mean "Those who will punish will come after you".

    • Re: (Score:3, Insightful)

      by EvanED ( 569694 )

      What the hell, why not add another syntax?

      To be fair, the syntax is very much like CSS. Further, it's not like it stays in the file for those who come after; it's just that the editor expands things for you.

      • by ari_j ( 90255 )
        So it's kind of like Lisp macros, except that they are expanded in the source to make maintenance both more difficult and less efficient than just starting over from scratch.
        • Re: (Score:3, Insightful)

          by EvanED ( 569694 )

          So it's kind of like Lisp macros, except that they are expanded in the source to make maintenance both more difficult and less efficient than just starting over from scratch.

          If that's your attitude, feel free to go ahead and use Markdown or ASCIIDoc or one of the other markup lanugages that you can compile to HTML.

          However, this is something you can use in documents that are already HTML, need to be HTML because that's what your employer or customer demands, etc. without affecting the end result. Saying "let

    • That’s what TypoScript is for. ;))

      You could see them all as domain-specific languages. (Except for HTML and CSS, which are not programming languages at all.)
      Semantics: HTML
      Aesthetics: CSS
      Logic: (3 layers)
      JavaScript - UI layer
      PHP - back end layer
      SQL - data layer

      So, in a way it makes sense. (Except for TypoScript, which makes no fucking sense at all [wikipedia.org], since PHP already is a easy template language. [PHP = PHP Hypertext Preprocessor!])

      Of course, after 10 years o

    • It's not another syntax, it's basically CSS.

  • Looks like an automated coding editor, will be nice to use with abbreviated languages like HAML [haml-lang.com] and SASS [sass-lang.com]
    • by arth1 ( 260657 )

      So instead of writing HTML and CSS, you need to know this tool, plus HAML and SASS, and HTML and CSS.
      That sure simplifies everything.
      Unless you skip the whole "know" part, that is, in which case what you produce shouldn't be unleashed upon others -- you won't be able to troubleshoot it in any meaningful way, for one thing.

  • Not sheer genius (Score:5, Insightful)

    by MichaelSmith ( 789609 ) on Sunday May 02, 2010 @10:57PM (#32069078) Homepage Journal

    TFA shows how Zen lets you type in a terse message and have it expanded into a chunk of html code and describes it as sheer genius. Thats neat but I have nedit macros which do pretty much the same thing. They are time savers for sure.

    But nothing which you couldn't do a thousand ways. With perl, awk or sed.

  • When I first started watching the video demonstration linked to from the project page I though "nice" but after a while of watching obscure string after obscure string I realise that I'm probably better off just trying to memorise HTML instead of HTML *and* whatever the hell this is.
  • Zen Coding? (Score:2, Informative)

    by i_frame ( 665737 )
    In my case, Bluefish or Quanta Plus are more than enough, don't need to learn another syntax.
  • by bcrowell ( 177657 ) on Sunday May 02, 2010 @11:14PM (#32069130) Homepage

    ...crappiest article ever to get frontpaged on slashdot.

    It's a couple hundred words worth of "OMG!" with a code example.

  • Accelerator (Score:5, Insightful)

    by neoform ( 551705 ) <djneoform@gmail.com> on Sunday May 02, 2010 @11:30PM (#32069192) Homepage

    an extremely well thought-out accelerator for anyone who codes HTML.

    I don't think that word means what you think it means.

  • by patro ( 104336 ) on Sunday May 02, 2010 @11:32PM (#32069214) Journal

    Emacs users can find the relevant package here [emacswiki.org] with screenshots and demonstration Youtube video.

  • Confirmed (Score:1, Funny)

    by Anonymous Coward

    How to program the onboard computer of the Liberator

  • by XaXXon ( 202882 ) <xaxxon AT gmail DOT com> on Monday May 03, 2010 @12:08AM (#32069392) Homepage

    I recommend sass and haml for doing css and html respectively.

    http://haml-lang.com/ [haml-lang.com]

    http://sass-lang.com/ [sass-lang.com]

  • by Greyfox ( 87712 ) on Monday May 03, 2010 @12:28AM (#32069434) Homepage Journal
    *head explodes*
  • by joost ( 87285 )

    z0mg zen! As far as I am concerned it's a nice gimmick. If you are going to 'Zen' up your html, why not go all the way and switch to Haml [haml-lang.com]? You actually code in this CSS-like syntax and let Haml compile it to html for you.

  • Writing source code is called "programming", not "coding". Coding is converting readable text to some sort of encrypted text.

    And for the observant reader, yes writing Perl source code can be both called programming and coding.

    • HTML is a formatting language, not a programming language

    • Programming includes elements of analysis, system design, algorithm specification, library selection, test methodology and all the other things you have to do to make a computer do what you want. Coding is the process of converting the results of all these specifications and decisions into something that can be compiled, by writing source code. Traditionally, they were done by quite different people (and the compilations and run done by a third group.) A lot of bad code results from design while coding. The
    • by lpq ( 583377 )

      But you didn't define the term "source code", nor make clear that "encrypted text" includes any code that is decipherable by the computer, directly, but may not be immediately decipherable to humans. Perl is hardly unique in it's ability to obscure underlying algorithms. I've seen plenty of obscure C and C++ code, and lets not even begin with assembler...that's encrypted to 99% of humans, by its design.

      Programming -- the art of taking concepts and translating them to discreet machine-implementable concept

    • A code is a system of rules that translates a body of information from one form to another. Say, for instance, markup to presentation.
  • by Viol8 ( 599362 ) on Monday May 03, 2010 @03:22AM (#32070118) Homepage

    You code in java,C++,javascript, but HTML is a formatting language - you do not code in it because it isn't a coding language. I know it makes fluffy web page designers feel like their playing with the big boys to talk about "coding" in HTML but you might was well talk about "coding" .ini files.

    • Re: (Score:2, Funny)

      by IRoll11!s ( 1609859 )
      Stop being so pedantic or I will hack your internets.
    • Re: (Score:2, Interesting)

      So what are you writing when writing HTML, and what shall I ask people to take a look at when I ask them to open a HTML document? "Open up that HTML document and take a look at the....stuff?"
      "Code" is a pretty broad concept. Perhaps you should look at this: http://en.wikipedia.org/wiki/Code [wikipedia.org]
      Any asshat can substitute letters for their corresponding number in the alphabet, but does that make it less of a "code"?
      No. Sorry but I am not convinced and this merely strikes me the same as when people argue the
    • by lennier ( 44736 )

      I dunno - you look up a big telephone book of business practices, pick a cryptic utterance that matches your needs and is utterly obscure to everyone else in the industry, then tap it into a telegraphic keyboard - HTML sounds like coding [wikipedia.org] to me!

    • I know this is Slashdot, but since when is elitism considered "insight?"

      A code is simply a system of rules that you use to translate one form of communication into another form. If that's all you're doing when you're programming, turn in your keyboard now. Writing HTML is coding but it is not programming. Programming is writing a program - a system of instructions which inform the computer how to perform a novel task. HTML is scripting however, even if the script is trivial - it says "Do what this says"

  • Those who do not learn vi are doomed to reimplement it. Poorly.

  • The True Path To Enlightenment (TM) lies in using Reverse Zen Notation (TM):

    So "div#page>div.logo+ul#navigation>li*5>a" becomes

    a>5*li>ul#navigation+div.logo>div#page

It is contrary to reasoning to say that there is a vacuum or space in which there is absolutely nothing. -- Descartes

Working...