Earlier quoted context omitted.
I still have 0.3 in my code base, and there are some gems like: // Arrrrghhhhhhhh!! // I overwrote the event plugin's .load // this won't happen again, I hope -John BTW, do you know what happened to Dean Edwards. He was doing some really interesting work around the same time as you.
[deleted]
John Resig annotates original jQuery source code
91–100 of 102 posts
Re: John Resig annotates original jQuery source code
#92Earlier quoted context omitted.
[deleted]
i have some knowledge of the situation and it's fair to say he had some personal issues that consumed him and he had to make some drastic changes in his life
Re: John Resig annotates original jQuery source code
#93It's very kind of John to mention my first jQuery plugin in the notes. Unfortunately, it was not a very good plugin and probably set a bad precedent. Like so many new jQuery developers, I went "Chaining? Whoa. Chain all the things!" So I attached the plugin to $.fn, not thinking about the fact that what the plugin did had very little to do with the current element selection. I may have been the first to make this mis…
Then you get things like $("#target").MakeBobsFancyBoxWidget()
Re: John Resig annotates original jQuery source code
#94What surprises me is the lack of comments in the original file. This leads to e.g.: this._get(i).$$tmpFunc = f; this._get(i).$$tmpFunc(i); this._get(i).$$tmpFunc = null; with the comment (from now): So this may look crazy — it certainly does to me! Why not just do: f.call(this._get(i))? If I remember correctly, and I just did some double-checking and I think this is the case, but IE 5 didn’t support .call()! The orig…
Also with all my respects to mr. Resig, but this is not really code to learn from. It's full of bad habits and it's hard to read. Poorly named, mostly uncommented and pretty hacky. Not really judging, it was just a bunch of handy hacks he had for personal use. Another reason it's hard to follow is of course: writing a CSS selector is not a trivial task, and that with all the browser quirks workarounds. I'm sure getti…
Did we have minification tools back then?
Re: John Resig annotates original jQuery source code
#95Re: John Resig annotates original jQuery source code
#96Earlier quoted context omitted.
This formatting style for annotated sources always seems to work so well: http://robflaherty.github.io/jquery-annotated-source/docs/01...
Indeed, that side-by-side annotated style is great. For those who would like to create similar pages, the original program is Docco[0], a Javascript project. However it's been ported over to many other languages and can be found in these projects: - Pycco[1] Python - Rocco[2] Ruby - Shocco[3] POSIX Shell - Many more, as found here[4] Note each of these projects support highlighting different languages. For example, t…
Re: John Resig annotates original jQuery source code
#97Earlier quoted context omitted.
Also with all my respects to mr. Resig, but this is not really code to learn from. It's full of bad habits and it's hard to read. Poorly named, mostly uncommented and pretty hacky. Not really judging, it was just a bunch of handy hacks he had for personal use. Another reason it's hard to follow is of course: writing a CSS selector is not a trivial task, and that with all the browser quirks workarounds. I'm sure getti…
> and then compact it with tools. Did we have minification tools back then?
Re: John Resig annotates original jQuery source code
#98Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…
I like it. It almost makes me wish I could comment my code like this somehow. I often find that long comments can break my flow when reading code -- but of course, commenting is necessary, so perhaps it could be useful to pull them aside in an IDE. Does something like that exist?
Re: John Resig annotates original jQuery source code
#99What surprises me is the lack of comments in the original file. This leads to e.g.: this._get(i).$$tmpFunc = f; this._get(i).$$tmpFunc(i); this._get(i).$$tmpFunc = null; with the comment (from now): So this may look crazy — it certainly does to me! Why not just do: f.call(this._get(i))? If I remember correctly, and I just did some double-checking and I think this is the case, but IE 5 didn’t support .call()! The orig…
Also with all my respects to mr. Resig, but this is not really code to learn from. It's full of bad habits and it's hard to read. Poorly named, mostly uncommented and pretty hacky. Not really judging, it was just a bunch of handy hacks he had for personal use. Another reason it's hard to follow is of course: writing a CSS selector is not a trivial task, and that with all the browser quirks workarounds. I'm sure getti…
this is not really code to learn from
I used to work with someone who could look over my shoulder, read and evaluate my code, and then tell me where my bug was within seconds. He knew the code better than I did, and I'd written it! I asked him about this mad skill of his and he directed me to easily the worst programme I've ever read in my entire life. [1]It was a block of unformatted, uncommented, dangerously typecast old-style C, with meaningless single letter names for variables and functions.
So I read it. It took a lot of study and I didn't cheat and run it through a pretty printer. I never really got to the point where I grokked it but my ability to read other code has improved a lot.
So whilst I agree that it's important to write code in the way you describe, I think it's well worth reading code that takes you out of your comfort zone from time to time.