Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
JZed.js – The functional JQuery alternative (github.com/zedshaw)
100 points by SEMW on Feb 8, 2014 | hide | past | favorite | 97 comments


> This also only really works on IE9 and maybe IE8 or better, but honstly IE6 and IE7 users users can seriously go fuck themselves with a dirty brick.

This kind of language doesn't belong in a software project, let alone its README, and is very likely one of the reasons software professionals are often not treated like professionals.


And what kind of language does belong in a software project? He's literally giving away work he did in his own time for free and you complain about the language he used when he did so?

If you don't like the language, don't use the library? Seems a simple solution.


That sounds nice, but I don't think it works that way. People see software projects like this, and they develop impressions that software programmers are not professional. The result is that programmers are not treated like professionals.


By the same logic:

People see reactions like yours and they develop impressions that software programmers are boring stick-in-the-muds. The result is that programmers are not treated as people you'd want to interact with.

In the grand scheme of things do you think that people who write like Zed are going to feel compelled to change their behaviour because you would like them too?


> People see reactions like yours and they develop impressions that software programmers are boring stick-in-the-muds.

That's probably better than being treated as unprofessional.

> The result is that programmers are not treated as people you'd want to interact with.

It's totally possible to be friendly and have a sense of humor without being distasteful.

> do you think that people who write like Zed are going to feel compelled to change their behaviour because you would like them too?

Nope, that thought never crossed my mind.


I would pick Zed's code over the code of a "professionnal" any day. I prefer direct, raw and to the point language over watered down politically correct speech any day. The former cares about substance while the later cares about appearances.

After years in the industry, I've become weary of the word "professionnal". It doesn't mean youre talented, it doesn't mean you have a good understanding of how computers really work. It only means you're good at being politically correct.

And that has very little value when it comes to developing software. You can't describe something rational using emotional language.


After years in the industry, I've become weary of the word "professionnal". It doesn't mean youre talented, it doesn't mean you have a good understanding of how computers really work. It only means you're good at being politically correct.

I agree with you entirely. I've heard the word "professional" at least an order of magnitude more when the topic of conversation is my mohawk rather than my work output or ability to operate in a team.

I see two options. Either I'm so middling at my job nobody would ever call me unprofessional, professional or suggest that I act more professional. Or, as I suspect, the word "professional" is a nothing but a tool to conflate the social signaling of conformance with the ability to perform a job.


"Politically correct" seems to mean "being respectful, courteous, and considerate of everyone involved". I fail to see how that's a negative thing to be avoided, or how it's "watered down".


That's negative if you use it as a filter. I'm not saying being polite is wrong, far from it. What I'm saying is that professionalism is a mediocre metric in our industry. Just like lines of code is a mediocre metric for the progression of a project.

Both metrics look good on the surface. Yet using them shows a very poor understanding of what engineering is.


Do you have any data or evidence backing this up? Because it's completely out of sync with my personal experience.

I've found that if you want to work as a software engineer with people who don't make those types of judgments and regard and pay you as a professional, there are more than enough opportunities.

You may find swearing distasteful, but for some of us working with people who judge us based on some moral assessment of our language is just as repulsive.


It really does, in fact, work that way. Vulgar language is pretty common both in OSS and, perhaps surprisingly, in private codebases. I assume you don't subscribe to LKML, or have never read the linux kernel source? grep -ir fuck in linux, you may be surprised at what you uncover.

I understand your point and on a personal level I agree. I maintain a level of professionalism in my own work. I find that kind of language ultimately unproductive.

However, the OSS world has a good deal of engineering talent that swears like a sailor and is, at the same time, quite successful. This is simply an observable fact.


You're totally right. There are plenty of super talented and productive people out there of all kinds. But that doesn't mean none of them are giving programmers in general a bad name. Some of them very likely are.


I'm much more interested in protecting individual freedom of expression than I am with worrying whether there are people out there who are so crass as to collectively judge the entire field of software development.

Code is speech. Open source projects often have a subtext of affecting a political or social change either within a software community, or sometimes beyond. In this particular case, my reading of the text is that Zed wishes to create a baseline of ridicule for those who would prefer to alter software to support extremely old browsers. It's a fair position, and while he may be able to make that point without vulgar language he may also be effectively speaking to his audience with his crude humor.

As merijnv noted above, if you feel so strongly about language you're free to not use his project. He is free to speak and code as he wishes and you are free to support what you wish. This freedom of expression is extremely valuable, not because the word "fuck" has any particular intrinsic value, but because it's a culture of permissiveness which enables people to speak their minds and attempt to affect change even if they're clumsy and crude with language. Because it allows comedy -- and everyone's perception of comedic value is different.


> Open source projects often have a subtext of affecting a political or social change either within a software community, or sometimes beyond.

One time, I almost used a custom license in one of my projects which would have required my users to read a controversial book that supported my stance on something. It was intended to be half-joking and half-thought-provoking. But I decided to abandon this and use a standard free license, figuring that it's completely the wrong venue to try to effect social change, and it would prohibit people from deriving any utility from my project. I wish all public software projects would do the same. I know, it's a pipe dream, but a man can wish, can't he?

> As merijnv noted above, if you feel so strongly about language you're free to not use his project.

It's not practical to avoid using a project just because I disagree with its attitude. And it makes no sense to boycott it on principle, as I don't think so highly of myself to think my stance on something like this will actually have any kind of effect. I only wanted to comment on this to open discussion about the matter.


Sure. But do keep in mind that truly outrageous speech and behavior really does tend to have a devastating effect on the success of projects. We don't see that here because the speech really isn't outrageous or hurtful -- it's merely comedic and vulgar.

You may want to consider that your personal values aren't representative of the norm.


Maybe Linus should stop insulting people in a geeky way. And Bill Gates should have not been so nerdy. They affected people's perception!


I think a better analogy are the kind of programmers who make the kind of sexist jokes that you'd find in an Eminem song. This attitude proliferates and becomes such a general stereotype about "programmers" that it gives rise to activists[1] who work hard[2] to fight it.

[1]: i.e. https://twitter.com/steveklabnik

[2]: probably too hard


So what makes the analogy better isthatthey promote the stereotype that programmers harm people. I agree, this is the same kind of group self policing that Bruce Schneier would describe in The Dishonest Minority when for example local merchants screw tourists. Although individual reputation isnt affected, the group reputation is.


>People see software projects like this, and they develop impressions that software programmers are not professional.

Who other than programmers do you think is going to see the readme?


So you're saying that you shouldn't criticize others just because they're giving it away for free?

If you question that others shouldn't complain about other things then we quickly end up in a world where movie critics can't criticize a movie since they didn't pay for them. Where I can't criticize google since their services are for free.

You should always speak up and voice your opinion. But your argument "don't complain, take it or leave it; it's for free" can't be applied anywhere IMO. In fact, the author should be thankful for any critique he's getting. Not getting any feedback means that nobody cares about your work or doesn't care about you failing.


> If you question that others shouldn't complain about other things then we quickly end up in a world where movie critics can't criticize a movie since they didn't pay for them. Where I can't criticize google since their services are for free.

Not really. It's like the movie critic spotlighting a comment the director passed on set. Or you bitching about a comment in Google's C++ code you saw on a Googler's laptop. You know, you don't have to care about that stuff. Just use it!


1953 called, they want their prudeness back.

I like a little humor in my software projects, especially the type of humor that I can relate to. It reminds me than the people I work with aren't just "software professionals", but humans with personality and a sense of humor.


It's kind of sad that decency is now considered outdated.


It's kind of sad that you think the word fuck is indecent.


I assume English is your first language, hence you should be aware that it is a profanity. To some, that is reason enough. I don't see why you are acting surprised; and it isn't witty in the context of this conversation either.

If offending old neckbeards doesn't bother you, then as a software engineer, don't you think most profanities are incredibly vague and meaningless - to the point where expressing them serve as nothing but a method to reduce the signal-to-noise ratio rather than as a method of communication?

There are effective ways to indicate the whole range of emotions that a profanity may represent. Many witty, precise, nimble bits of communication that can use to delight, shock or enlighten your partner in whatever way you choose.

Profanities, on the contrary, are trite, boring, counter-intuitively childish conversational shortcuts which moreover assumes that you share a common frame of reference with someone else who will "get it", and suggests one doesn't want to invest effort to communicate distinctly one's ideas.

Frankly, your response didn't warrant a long rejoinder (as you probably didn't think it through) but it is such a common response in this thread that I thought I owed it to one of you to at least try to explain why some of us really don't put profanity in our code and try to avoid using it in a professional or personal context.

PS: I don't see the long stream of profanity in PG's essays, do you?


Yes, english is my first language. Yes, I thought it through, and your hand wringing about profanity being imprecise and childish are typical of people who complain about its use. It also misunderstands the purpose of language. Liberal use of profanity is about freedom and tone, not about conveying a precise meaning.

I choose the anarchic language of the people over your prudish, sweaty-palmed nannyism.


> Liberal use of profanity is about freedom and tone

I've noticed many people using "freedom" as an excuse to say or do very (often intentionally) offensive things. That's not freedom, that's an abuse of freedom.


To be clear, I was using free in the sense of "unencumbered." However, since you bring up freedom of speech, I say, what use is freedom if you're not free to offend people?


I really wish I could see how many upvotes and downvotes other comments and my comments have. It'd be really interesting to see some kind of statistics on the general HN community's stance on disagreements like this.


It's not decency that's outdated. It's your standard of decency that's outdated.


heh. i'd expect nothing less from zed. this comment makes me assume some of you youngsters don't know who he is.

from his site:

"Yes I say "fuck", and quite a lot of "bad words", mostly because it's funny to watch you shit your pants at them. It's not like you're going to give me a job so fuck it, I'll say fuck. fuck fuck fuck fuck fuck*

*Did I mention? fuck"


That's just juvenile. I don't "shit my pants" over stuff like this, I roll my eyes.


I guess that's an upside of the personal Software Project: you're under no obligation to listen to Software Professionals telling you what does or does not Belong in it.


Yeah, a little too rock n roll here. Also, I don't think there's such a thing as a IE6/7 user (in the sense of mass of visitors to support for a website to thrive), only people forced to use it by heavy constraints.

ps-edit: I mean, Zed Shaw knows about enterprises locked into IT contracts etc etc, so his comment was free noise. I guess that's just how he likes to speak and joke.


Honestly, I'm starting to think IE6 is just an urban legend. I mean, has anyone ever actually seen it?


You're kidding right? You must live in the Bay Area. There exists these other continents named South America, Africa and Asia. I know I sound crazy right now but people in those mythical lands I just mentioned don't have the latest and greatest computers, or anything remotely close.

Try closing your eyes for a minute and imagine a land without latte art, Apple products and toques. It'll blow your mind.


I don't think these people are stuck with IE6 either. I'm pulling this out of my ass but my belief is that IE6/7 users are people who don't own the machine, in other words employees stuck with corporate system[1]. Other than that you can just install and run firefox or chrome on old machines[2].

[1] I've seen it in national offices were they could only use a verified systems that were implemented by some company in the win95 days so they can't upgrade. In other companies they bought brand new lenovo desktops and scrapped vista to put xp+office2k3 for IT support and compatibility reasons.

[2] I run a 2006 laptop as my main one (tpad x60s), and often use a 2005 x41 on the go with no issues.


I live a few minutes away from nothing but cornfields. Also, the IE6 thing was my attempt at humor. :)


Oh, then you won't mind that Zed's swearing is his attempt at humor too.


Surely you can see the difference between intentionally offensive humor, and relatively benign humor?


There is still a visible % of IE6 users on more general sites. Most of the HN crowd will tell you IE6 is dead and Chrome has the largest browser share, but on a more general audience site (e.g. bloomberg.com), IE6 still has users (not all from China) and IE is still the dominant browser.


I don't know but we shouldn't write its name too often I don't want to summon evil spirits.

ps: this made me google a bit for %, seems like 6 and 7 summed are around 7%.



"It's legit purpose" annoys me much more. It's Its, for fuck's sake.


You're making an unfair generalisation. I'm not sure if that kind of language is often used in software projects, and this specific project comes from Zed Shaw that is well known for his quite "unique" approach to software projects.

I don't know if you're aware of http://programming-motherfucker.com/ -- again, it's a joke, a parody, and it's funny as jokes and parodies are. But honestly, I don't think anybody will really use that kind of language or attitude in a professional environment.

EDIT: typo



I heard his talk on DjangoCon, it was strange at first, but now I'm kinda used to it, even expecting him to talk that way..


...says the tone police.


This is such an overused fallacy lately. It really seems to just be the go-to phrase in disagreements whenever courtesy and respect are discussed.


It's not overused at all... tone policing is the most uninteresting and outright annoying response you can possibly produce in a technical discussion. Also, this: http://commons.wikimedia.org/wiki/File:Graham's_Hierarchy_of...


Clearly, you aren't familiar with Zed's oevré.


>> I'm doing a bunch of work with CORS and requiring target sites to use jquery is insane when I just need a few little things.

Why would target sites need to have jquery?


I don't understand this also. Isn't CORS a server thing? I have used CORS, but still don't understand this.


I'm a fan of min.js[0], as it is closer in spirit to jQuery. Looks like the major addition this has is the XHR. Not sure how I feel about the individual $method style, but it looks like you covered almost anything one would need!

[0] https://github.com/remy/min.js


I'm guessing zed was bored - or just felt like trolling?

The library isn't "functional", does very little of use, and horribly pollutes the global name space.

Maybe he just felt like venting about jQuery overuse and snobby programmers.


> The library is tiny. Seriously, just go read the code. It's good education

Thanks, Zed! I really appreciate what you have done for helping in education in other programming languages. Reading a small library which does much the same as Jquery is a great addition to your materials. I may not use this as a Jquery replacement, but I will certainly be looking through the code to see what I can learn from it. I spend far too little time in the front-end and it's time to change that.

Edit: Edit: Okay, you guys didn't like my joke. So I removed the joke and expanded on the first part of my comment.


If this interests you, check out http://zeptojs.com/. Seems like the same concept.


Zepto really aims to match the jQuery style and the majority of methods while trimming the fat and sacrificing browser compat, and weighs in at 9.2k min gzipped.

I'd say the only thing this has in common with jQuery is the use of the $. Most of the methods here can be found in many homegrown toolboxes. There is no chaining and no relationship to any of the methods here.


I guess the semantics really matter to some people but a few direct quotes from the Readme

JZed is my alternative to JQuery

This is a tiny amount of code that has enough of the functionality found in JQuery

then I filled it out with more based on the list at http://youmightnotneedjquery.com/.

The semantics are different but the functionality is completely based on jquery.


Zepto is nice, but if you want something like jquery, just use jquery. Jquery is already small enough and battle-tested. I tried using zepto a year ago, and some DOM methods were 10-100x slower, which isn't worth the reduction in size.


This is a wrapper around the DOM API, nothing like jquery at all.


You know that jQuery is primarily a "wrapper around the DOM API", right?


Not exactly, jquery offers it's own API which is what makes it powerful and allows for it's method chaining, plugin system etc. A $(".className") returns a jquery object , not a DOM element.


>Not exactly, jquery offers it's own API

Yes, that's the definition of a wrapper: it offers it's own API.


jquery is really it's own abstraction, the jquery API allows you to interact with jquery objects which can do DOM manipulation on your behalf. This library literally returns DOM objects.


jQuery API is nothing like the DOM API.

This library is a list of functions that are nothing but proxies for some other functions which you might as well call directly. Given that the author has written this http://zedshaw.com/essays/indirection_is_not_abstraction.htm... I am sure this is some kind of joke...


>jQuery API is nothing like the DOM API.

That's the whole point of making a wrapper around an API. That it doesn't look like the API you're wrapping.


I don't understand the talk about CORS. In what way does this library help CORS stuff and what situations is he referring to exactly?


What makes this library functional?


I see nothing that makes this library "functional".


Pull requests like this show it's rather immature so far:

  Fixed $next() and $previous() not returning anything - 2 hrs ago


So how is it "more functional"?


Don't like to much the name, is so "egoista", but i love the functional approach :).


In the Readme he says he picked that name to annoy people!


Annoying people is easy, I don't know why he would go out of his way to do it. It's certainly not something to be proud of.


How cross browser is this thing? Does it at least support all the browsers versions as JQuery v2?


This also only really works on IE9 and maybe IE8 or better, but honstly IE6 and IE7 users users can seriously go fuck themselves with a dirty brick. I may add a function to detect these two bad browser so people can start forcing them to use a real browser for a change.


There are parts that will not work in IE 8 (doesn't support addEventListener) or even IE 9 (doesn't support classList).


I like the idea, but the tone of the docs is a little too rough for me (although I don't consider myself a functional snob).

http://www.snapbugz.com/p/98f1d5a6


I'm really liking the idea of having lots of new $ instead of chaining/burying things like jQuery does. Most of the functions are bareboned but as a concept it looks interesting.


The reason jQuery (and _.js, and others) do this is so that you minimize the number of global variables/functions used.


While he's at it with the Zed-ing he could have made a z. module or even prefixed all functions with 'z'+CamelCase. '$' is cute as a root wrapper for chains but $map($filter($each.. $siblings, $http(..))) gets heavy quick IMO.


I love method chaining though, not having it is a huge drawback for me.


Looking through your code, you have some name mismatching in $parse. Best of luck.


Would be nice to detect CommonJS environment and not export to the global scope.


Always nice stuff, it would be cool if Zed would publish this on npm or Bower.


This gives me an idea of reimplementing jQuery as part of learning javascript.


Don't do that, do something no one has ever done.


cool, this guy is doing some good work.

see also mongrel2, a language agnostic webserver https://github.com/zedshaw/mongrel2


function $new(tag, id, html) looks like it has a bug.

next line should read var new_tag = document.createElement(tag); not var new_tag = document.createElement("div"); unless I am missing something


Isn't this what GH Issues is for?


Zed actually fixed it - this joke will run and run. Smashing.


Thanks! But I've long ago replaced my js with clojurescript.


>It's also functional so now LISP hackers can pretend they're both JavaScript Oakland Living Node.js gangsters and high class San Franciscans with their functionality snobbery.

Oh Zed. Don't ever change, our industry needs people like you.


Zed is dead.


As your comment.


Jay-Z will be along for trademark infringement in 5... 4... Same as Coinye West!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: