Sophistication in Web Applications?
whit537 asks: "Anyone who uses Gmail for 5 minutes can see that it's a pretty dern sophisticated web application. But just how sophisticated? Well, first of all, the UI is composed of no less than nine iframes (try turning off the page styles in Firefox with View > Page Style). But then consider that these iframes are generated and controlled by a 1149 line javascript. This script includes no less than 1001 functions, and 998 of these functions have one- or two-letter names! They're obviously not maintaining this script by hand in that form. So do they write human-readable javascripts and then run them all together, or have they developed some sort of web app UI toolkit in Python? Does Gmail need to be this complex or is the obfuscation a deliberate attempt to prevent reverse-engineering? And are there any other web apps that are this sophisticated?"
I don't believe that the naming of the functions and variables is simply an effort to obfuscate the code. There is that, of course, but the main reason is probably to save money on bandwidth. When you have millions of people hitting your servers you can scrape quite a few bucks by removing white space and reducing the size of your files the way they have.
It has to be the richest web application I have seen.
Incredibly well designed, flexible, and scalable.
They are years ahead of the nearest competition.
This
While doing research for an AI project, I found a project that does this, kinda, and is written totally in PHP, etc... its called AIStockBot
Its nicely obsfrucated, but it's open source... some of their algorithms and predicting phases are quite complex. I decided to do something a little more basic and written in C. mmmmmm C...
while(1) { fork(); };
The send out a lot of data and don't waste any bytes. That is why they compress the names. Similarly, look at the google page: no spaces.
I think he may have derived "in Python" from the fact that Google has been hiring many Python programmers in the past couple years.
... just like the rest of this article.
However, it was completely uncalled for speculation that had no place in a Slashdot article.
I'm with you, "huh?"
Random and weird software I've written.
1200 lines of Javascript might seem like an enormous amount to a dreamweaver monkey, but it's hardly any code for anyone who does real programming*. Check out the scripts for Outlook Web Access for example. Or any other intranet/portal type application.
(*Well, many 'real programmers' are loath to do rich client stuff in JS, perferring their server side frameworks instead. But once you get the hang of it, it's pretty nice.)
Javascript is more-or-less object oriented. Have you ever used it? It is actually a pretty clever little language, with quite a bit of utility.
MSN's http://webmessenger.msn.com/ is a web-based MSN client implemented using a combination of HTML and Javascript. The source for the javascript is available here. I was looking into how it worked the other day and tidied the source into a more readable form. At least MSN had the decency to leave human-readable function names... this fact alone makes the code reasonably understandable.
Do you still need to be sent an invitation to setup a gmail account? I never got around to signing up during the initial wave of hype and I would appreciate it if anybody could send me an invitation.
parent poster said pretty much what i was about to. i've written a fairly complex hierarchy menu in OOP javascript. there is also a project that's been around for sometime called dynapi that seeks to make a cross browser OOP javascript system for widgets.
- tristan
"pretty clever little language" is the understatement of the year. The entire UI of the browser that I am using now is done in javascript.
Both Perl and Javascript can be maintainable if the programmer designs their code with that goal in mind. Besides, Gmail has slightly more than 1000 lines of code. That really isn't really a maintenance nightmare.
Java is an object oriented language, but I could certainly write Java code that would be a major headache to maintain if I chose to do so. I think most maintenance problems come from poor coding habits, and not the language its self.
Sure, it's sophisticated, but 1149 lines of javascript isn't rocket science. Anyone worth their salt in javascript programming along with dhtml and css can reproduce this with about a month of solid coding. The trick is getting the cross-browser stuff working correctly, the rest is standard client/server stuff.
Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
Actually, if you browse around Google and Gmail, you'll find tons of links like this one - the file has a .py extension.
Google writes A LOT in Javascript. It would not surprise me, although I have no evidence of this, if they wrote the code in their choice editor and then ran a python app that condensed the code to remove space, renamed the functions, and replaced all function references. At 1000+ functions, if the function names had just 5 letters each (not much if you're not being terse), that would be an extra 3000 characters (3k) PER PAGE LOAD. Multiply that times thousands (tens of thousands after general release?), and you'll see A LOT of extra bandwidth.
Have you ever used JavaScript outside the browser? It's a very sophisticated object-oriented (prototype-based, like Self.. you can also use prototypes in Perl and Lisp and other "roll-your-own-objects" languages, I've noticed.. this means new objects are made only by copying other objects).
So it's funny when you and the original poster opine that it must be written in some "other" language.. JS is actually more sophisticated than, say, Python!
I recently saw some JS code online that added many Ruby-like dynamic methods to the standard JS objects.. pretty amazing I thought.
JS, along with other "embedded" languages like PostScript and Forth are probably way under-appreciated yet are vital for many functions.
using one letter variables is a horrible idea in practice(although there is an exception-- for auto incrementing variables, i++). who the fuck wants to maintain an application with 2-letter functions? a word is much easier to remember then 2-letters. Google most likely has a framework of how they do things and having short JS variables/id's/classes is part of that. Why do you need big variable names? They just take up space, are harder to memorize, and you're going to have to look back through the code to see what they do anyway. that's horrible logic.
developed some sort of web app UI toolkit in Python?
This is why I call Python "Java of the open source world".. so many people think all programming begins and ends in Python.
JavaScript is *already* a sophisticated, object-oriented language. In fact the design of the language is somewhat cleaner than Python. Why do you think they would write it again in Python somehow?
Kirby
well for starters google is publicly traded now which means the investors have first say on how the technology works, NOT the engineers. More characters = more bandwidth = higher cost of operation = cut in profits = stock prices go down.
Also which has been touched on alot. For a script that size, chances are what we see is probably the product of code optimization and or a front end program that translates human readable code into smaller "optimized" code for the site.
"It's better to be a pirate then join the Navy"
The objection may be valid for an interpreted language; however, for this, you can use a pre-processor that will substitute a terse compact name for a long explicit one.
I did that some 15 years ago when I had to maintain 15-20 year old Business-Basic code which did not allow more than 1 letter + 1 digit variables name.
I wrote a pre-compiler that allowed long variable names that you could pre-define (for existing code) and explicit line labels names, as well as permitting do-while and do-until loops (translated as IFs and GOTOs).
The end-code had also plenty of REMarks containing the "source" code so you could see what the program did even by looking at the resulting "object" basic code.
This is the reason for gmail pissing me off so much. It seems that all of this complexity just prevents use of normal browsing, and it regularly breaks down on me (are they ever going to fix that 'Loading...' bug?)
For example, embedded URLs in emails don't just link to the website, or utilise the 'target' attribute - they use javascript which prevents me from opening them in new tabs (I have to drag them onto the tab bar). Same thing goes for email conversations - but I can't drag those, so there's no tab support at all.
Yes, this is a nice little feat of JavaScript engineering (or whatever process they used to do it), but in practise, it makes gmail slow and hard to use. I don't see anything they couldn't have done with regular HTML, CSS and minimal JavaScript that would function like people have come to expect a regular web-page to function like.
At 1000+ functions, if the function names had just 5 letters each (not much if you're not being terse), that would be an extra 3000 characters (3k) PER PAGE LOAD. Multiply that times thousands (tens of thousands after general release?), and you'll see A LOT of extra bandwidth.
You're forgetting the effects of caches. I agree that they probably developed the Javascript the way that they did to minimise bandwidth use, but the impact isn't anywhere near as much as you imply.
Any text editor worth its salt has a option in the search function to match the whole word, and not the text anywhere in another word.
http://www.perthonline.net
For the number of times "ii" occurs in english you could save yourself a character, right there.
Now, I'm off for a bit of skiing...
People can be fooled into thinking things are sophisticated apps when they're really not. I'm reminded of a famous anecdote from Danny Hillis. He was trying to sell his Connection Machine with WAIS software to a CEO for enterprise-level data mining. He gave the CEO a demo at his shop, the CM1 did its thing, and the CEO was totally unimpressed, and said, "hell, my IBM PC back at the office can do that!" Hillis couldn't believe a 286 could do something that requires a CM1 supercomputer, so he asked the CEO to take him back to his office and show him.
So they get back to the CEO's office, and he uses his PC to dial up Dow Jones News Retrieval service and runs a monster WAIS search.. which used a CM1 that Hillis sold to Dow Jones.
Aside: I generally use c for my incrementing variables, and foo for my unknown type variables (common in returns in un- or loosely typed languages.
OnTopic: Looking at the code, Google likely has a more verbose code base and runs it through a stripper that minimizes the code and removes comments and excess whitespace. Since they use Python internally, especially in their GMail site, it would be a likely choice for such an app.
While the one and two letter variable names are not at all unmaintainable, I'd imagine that comments and most importantly, indentation are maintained in the original.
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
Exactly. Shorter function and variable names means smaller code. I thought that much was pretty obvious to even the least experienced programmer. In Google's case, I'm sure this is about saving a few bucks - although it does do that - but about producing smaller and faster web pages.
"Accept that some days you are the pigeon, and some days you are the statue." - David Brent, Wernham Hogg
I could probably map a macro to something like "search whole word" if I felt like it. However, I've found using "iii" to be an idiom well worth using in conjuction with vim.
Kirby
Dynamic languages are kick ass, I really really like them, but they're for prototyping, not writing maintainable production systems. Static, type checked languages are currently the best way to write maintainable code. In the future we'll have even more formal methods to play with and we can make even more maintainable code.. that doesn't mean we'll leave dynamic languages behind, it just means it will be even more evident that they're not suitable for production systems.
How we know is more important than what we know.
Just remember that Javascript is OO but not via classes. It is a prototype OO language (see others like Self).
ruby -le"32.times{|y|print' '*(31-y),(0..y).map{|x|~y&x>0?'
If there are so many with excess invites, I'd like one too... please?
Pretty please?
It kept me from falling asleep many a day in high school. Curse the unavailability of scalar variables... and only 6 precious, precious lists.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
that would be an extra 3000 characters (3k) PER PAGE LOAD
Well, that js file would be cached by the browser, hopefully, not reloaded with every single page load.
$8.95/mo web hosting
When you sign up to be a Python Programmer you have to promise to evangelize rabidly. At least that's been my experience. Evangelism must include suggesting that python is the best language for every job, trashing every other scripting language, and suggesting that Python is what makes the Holy Grail work. ...and to mod-down any Slashdot post that doesn't beatify Python, I'm sure. There goes some karma...
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
Well, that js file would be cached by the browser, hopefully, not reloaded with every single page load.
True, but that's only per user. Thousands of different users would still generate thousands of hits, and thus thousands * 3k of unnecessary bandwidth.
One could argue that Perl's language design is not amiable to maintainable code
If you mean Perl doesn't force you to write good code the way Java does, yeah. And I'm happy for it when I need to do something hard, like multithreadded servers.
But if you're suggesting Perl doesn't let you write good code you'd be wrong. There are some pretty big, successful, rapid-release perl projects out there that are well done and well maintained. Spamassassin is just one example of a public one. Ticketmaster would be an example of a private one (yes, that Ticketmaster).
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
You insensitive clod, I don't have a gmail account to look at it... :) Unless someone wants to send me one.
Mid-Eastern Pennsylvania Gaming Convention
javascript's type resolution is definition based
. html
this means the execution environment determines the behavior of namespace/module resolution issues (by dynamically loading code from external files or whatever as required with some intrinsic)
This way you can break your project into independant modules, implement test harnesses, etc.
javascript allows you to scope and prototype objects and defintions.
You provide namespace scoping by using nested definitions. And prototypes (i.e. classes, not clonable objects) are created using the prototype keyword.
Also check this out:
http://www.crockford.com/javascript/private
The tools are there. Unfortunately, you won't find many guides anywhere about how to use these properties to write maintainable code or work it in a collaborative environment. Discussions about closures and anonymous functions is also few and far between. But you will find endless discussion about detecting the DOM of various web-browsers (sigh).
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
"And are there any other web apps that are this sophisticated?"
Is this a joke? There are much more sophisticated web apps out there (leaving aside the searching bit). Since client-side seems to impress, check out hushmail.com. That is on the low end of "sophisticated".
Property law should use #'EQ, not #'EQUAL.
*correction - a water skiing resort... in hawaii... working on an ascii front end for a diiodide metering device... Just a though: /usr/share/dict $ grep -ic ii words
419
"Sanity is not statistical", George Orwell, "1984"
Nah, there's not much you can do with a list like that. Instead, how about a list of things that are really simple, but people persistently believe are terribly difficult? Now THAT would have some potential!
I'll start the list:
1. Counting votes.
how do you run JS code w/o a browser?
I second this question!
I'm also wondering why the heck the original post that started this whole thread has been modded Flamebait?
Run one of the videos. If you have Plone give it a try. Slick.
A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
haha that would get +1 funny if I had any mod points!
SURELY NOT!!!!!
Some projects that use Spidermonkey that aren't all web browsers
That's scary.
Amusing proof of writing nightmare code in any language
People seem to have it out for Javascript at Slashdot. Heh. A lot of negativity towards the language. I've seen some beautiful javascript, but I guess I'm one of the few.
That's scary.
yup dats q of v.
Netscape use to (and may still) offer servers that run JavaScript on the server for CGI and the like, much like mod_perl, PHP, or ASP. And speaking of ASP, you can use ASP to run JScript, which is MS's inplementation of ECMAScript (The ECMA standard name for JavaScript).
Herem Here! Javascript (or at least ecmascript) is the bomb
Too bad ofcourse every browser has its own implementation witch makes it harder to write clean code.
No comparison to the Netscape4 IE3 days where they were a 100% different though....
Computers?
Without quite a bit of extra typing? You just need to add triangle brackets to signifiy the word break. (Don't forget to escape them.) For instance, if I want to search for words ending in x, I type "/x\>" (the front slash to signify the search). For the word "i" all alone, it's "/\". Simple as that.
:)
How we know is more important than what we know.
Javascript, Perl and other interpreted languages have one enormous advantage when it comes to maintenance - particularly when you're trying to maintain a system written by someone else.
Because they're interpreted, you can always find the source code - and because you can copy the source directly from the production deployment, you know that the source you're working with is the correct version. You ever tried to debug or modify a compiled application where the original developer has moved the binaries onto the production systems and then lost the source? Or trawled through ten or twenty near-identical source trees trying to work out which one corresponds to the latest stable release candidate? This will usually be the directory called "Copy (4) of project.0.9.NOT_WORKING" or something similarly intuitive.
With all this talk of open source, it's worth remembering that interpreted script is about as open as source can get.
-- Open Source: It's mad, but you don't have to work here to help.
Pardon me... But why in the world do you need to search for incremental variables in the first place?
A source file can contain a dozen for's and while's; isn't it easier to search for the function name and then look inside that function?
Anyway, since we're on the topic, wouldn't it be nicer to name your inc variables xxx ? It doesn't naturally occur in the english language (unless you write really perverse comments) and it's fun!
Imagine the pleasure you get from reading a code snipped like:
for (xxx = 0; xxx < 0xfffffff; xxx++){DrawFrame(xxx);}
Sometimes I wonder why I read replies.
Y'know if I spent my days debunking every sadistic anonymous moron who wants 'freedom' to be when everyone to suffers and dies at the hands of political masochists, where would I be? I can't reason with people who want to kill every person trapped under a government that will encage all who take a shit without its permission. Please keep in mind that you can go to Hell if you love supporting torture.
I am NOT a number! I am a - oh wait, I'm number 761710. Look! 761710!
Compiled languages...
I was talking about Javascript. 1000 lines or so to be specific.
I am NOT a number! I am a - oh wait, I'm number 761710. Look! 761710!
The Mozilla project contains a couple of embedable JavaScript engines. http://www.mozilla.org/js/
wouldn't it be nicer to name your inc variables xxx ? ... it's fun!
Which reminds me of my favourite sites to visit when my internet access is through monitored firewalls (corporate or university systems)
http://xxx.lanl.gov/
http://xxx.arxiv.cornell.edu/
http://xxx.adelaide.edu.au/
http://xxx.uni-augsburg.de/
Yep, folks - Governments and Universities worldwide, hosting xxx sites. And for what it's worth, xxx.lanl.gov was the original!
"Go to CNN [for a] spell-checked, fact-checked summary" -- CmdrTaco
Kirby
(emphasis on the stinking)
I think this is really all I have to say about that.
You might as well complain about the logo, too. At 3300 bytes, it could tear down the entire Net! How could Google be so reckless?!!
Ryosen
One man's "Troll, +1" is another man's "Insightful, +1".
Unfortunately I cannot see the page. Would anyone care sending me a gmail invite ?
vi-family editors will certainly edit on a word by word basis - hit right and then 'w' (see above for searching on a word), and I'm fairly certain that vim will allow you to specify what constitutes a word break.
I agree that vi is pretty powerful. I used it for most of a decade when I was on Unix variants.
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
I'm surprised noone's caught on to this.
Google's all about HTML/JS compression. I remember reading an article about how Google goes to great lengths to reduce their HTML/JS fingerprint. It ends up resulting in real savings.
I wonder how those firewalls treat http://mirrors.playboy.com/ :) (office safe, really)
^^
Oh my.
dominionrd.blogspot.com - Restaurants on
In regular C, for a function, it's actually highly useful, and extremely desirable. Go look in any extremely large body of C code. You'll find out just how desireable C static functions are. They are used all the time inside of the Linux kernel. They guarantee that the linker won't make that symbol available externally. Which is great for avoiding two different functions with the same symbol.
In regular C, using static on a global variable also makes it have no external linkage. It also moves where the memory is actually set aside. Which changes when it gets initialized, and how large your executables are. I believe it's also a very good way to ensure your variables are safe to use in signal handler context. This is common go look at the Linux kernel. Happens all the time. Highly useful application of static.
In regular C, using static on a variable in function scope, can be useful, if it is also a constant. In that case, you can move the space off the stack and into the BSS section (at least under UNIX, I forget the equivilent under a Win32 platform). This again is used all the time in the Linux kernel. It shrinks the stack usage and saves space. As I recall, you want to declare all strings that are constants as:
static const char foo[] = "foobar";
It saves space in the kernel. I forget exactly why it does right off hand, but it has to do with the assembly that GCC outputs. I might have that wrong, you might want to do "*foo" instead of "foo[]", but you get the idea.
Now, in regular C using static on a variable in function scope to store state between function calls is an excellent way to introduce a race condition. So your blanket statement that "static is evil" is blantantly wrong. Whoever or where ever you learned it from was mimicing what they'd heard before without any understanding. Next you'll be telling me there's no good use of "goto's" either. Which isn't the case, they are few and far between, but they do exist. I've never come across one, but I am aware of when they would be useful. I could make use of them, but generally performance, cache coherency, and "the fast path" aren't things I generally have to worry about. Those are the types of problems we just throw more hardware at and keep the code highly maintainable.
I learned about a lot of thinks from my old boss, but the "iii" was one of the truely unique things, I've never seen anywhere else. Any good text on C programming will explain what I just did. The small useful things that you just deal with all the time because you never stop to think of a better solution. Paul didn't have too many of those. He recongized anytime something was difficult, and pondered the problem until it was easy. Just like, he knew when static was a good idea. Although I actually picked that up at school, during the explaination of Ada. You can do something named modules in Ada, that you can somewhat duplicate in C with static and separate translations units.
The truly most useful thing Paul ever taught me was just assume all of your code leaks memory. Assume your code will segfault because there is a bug in it. Assume you'll get crappy data that will lead to pathelogical cases. Design your code so that as much as possible that doesn't make any difference in terms of your ability to process data that doesn't cause a memory leak, a segfault, or isn't malformed. Never get stuck when there is more data to try. If some data elements blow up your code. Timestamp when you tried them and don't retry them for a while so you can work on other data. Any time you are doing batch processing, you should always have a parent that is deathly simple that will spawn children that do the real work.
Not Cobol but Cadol. In older versions, you saved space in memory by doing
NL
NL
rather than NL 2.
Java is an object oriented language, but I could certainly write Java code that would be a major headache to maintain if I chose to do so. I think most maintenance problems come from poor coding habits, and not the language its self.
I think this is true, but language is a factor. I have a soft spot in my heart for Perl, but I would much rather get handed 100kloc of badly written Java than badly written Perl.
one of the best tips from one the best programmers I've ever known, is use the form "iii" for all incremented variables [...] Why? Because if you use English Language descriptions, "iii" should never occur when searching except for in the case of your variable
This seems dubious to me. The only time I use a variable like i is in a nice, short loop, so I have no need to search. If a loop is too long to fit conveniently on the screen, I almost always do Extract Method (or I extract a function if it's not OO code). If I can't figure out a way to do that, I give the variable some meaningful name.
Using three-letter loop variables seems like a very clever solution to the wrong problem entirely.
But to stay on topic: I you wrote proper code, you would never, never ever search/grep or a variable like 'i'. Such a variable name belongs to a small loop (e.g. one that iterates through an array and increments an index) that can be read and understood quickly. It still might be better, depending on the circumstances, to call it 'count', 'xCoord', or 'offset', if that's what it is, but the point is that it is only defined within a small block and its function can easily be understood in that context. However, if a variable is used throughout the whole program, so you'd actually like to search for all the places it's used in, giving it a descriptive name is a must. Using 'i', 'j' and 'k' all over the place and doing all kinds of things with and to them is absolutely insane.
but what do i know, i'm just a model.
It's much easier then just scanning for them by eye, and more accurate (computers are good at looking for a series of text, my eyes aren't nearly as fast). Plus I won't have the bad habit of saying "find again" in vim if I write a bad regular expression.
Finally, I'll point out, that if you are iterating over an array, giving it any value but "iii", "jjj" is less idiomatic, and thus in some schools of thought bad (I'm a subscriber, but not sure a full fledged zealot about that). There isn't a better or more meaning full name if what you are doing is iterating over an entire array. Now, if you are skipping around, that's a whole different deal. There you can have a better name.
Finally: If I can't figure out a way to do that, I give the variable some meaningful name.
Wait, so what your telling me, is that in complex loop that has a long block of code that you can't figure out how to decompose, you change to use a longer variable name to make the code longer, and have more line breaks and use less idiomatic code? In complex long blocks code, you stop following coding conventions as old as the hills just doesn't sound like as nearly a good idea as making it easy to track down indexing errors. I'll give you the last word if you want it, and just agree to disagree with you.
Kirby
i have a week of finals before skiing.
its that time before hell freezes over,
and the coder comes out to play.
hope you've got good conditions,
its been a crazy "winter" here on the east coast.
I'm not searching for them because they are so far apart, or because they are hard to find. I'm searching for them, so I can ensure I double check each and every single one is correct.
I'm glad that works for you. I feel like if a block of code is hard to read, I should make it easier to read. If you'd prefer to search, that's fine by me.
Wait, so what your telling me, is that [...] you change to use a longer variable name to make the code longer [...] use less idiomatic code [...] you stop following coding conventions as old as the hills
Yes, you're right, I was trying to say that I'm an idiot. Because there couldn't be any other possible interpretation what I wrote, right?
The biggest problem with programming in JavaScript is the incompatiblity of JavaScript among browsers and even across versions of browsers. If you're writing an application in which the end-user is using one type and version of browser, it's not a problem. If you're writing for the mass market - major headaches. To make matters worse, there are major incompatibilities between versions of IE - IE4 is very different from IE5 and IE6. And you can't count on end-users having the latest browser. When I write JavaScript: much of the code is redundant - having to deal with browser specific dependencies. This makes JavaScript one of my least favorite languages (and I was one of the authors of an early book on JavaScript)!
...
P.S. If anyone could spare a Gmail invite
[Insert pithy quote here]
Well, aren't you clever not bothering to clarify so I could possibly understand what you mean. I've never said anything about naming anything besides an "increment" variable used in a for loop. You start discussing giving variables "meaningful names". In sections you can't refactor. What precisely did you mean? What am I misinterpretting? To me that sure looks like your saying you stop using "i" at points as the index variable in a for loop at some points, but not at others based on if you can refactor the for loop.
It's really hard to understand you've either changed contexts and I didn't notice. Giving variables meaningful names is a wonderful thing. However, how meaningful a name do you have for a variable you are using as an index? Maybe you could give me an example? I'm not trying to be a prick, but I read the words on the screen and took what seemed the most natural interpretation. Maybe there's some small chance you weren't being clear.
Kirby
Has anyone else noticed that the quality of Google's search results has been droppng over the last year?
This is my sig.
Well, aren't you clever not bothering to clarify so I could possibly understand what you mean.
If you're interested, I'm glad to explain. Traditionally, people indicate that by asking questions rather than assuming the worse, but I'll presume you're doing it differently.
Nobody said the code was hard to read
It would seem to me that if you're having enough trouble finding the uses of a variable that you need to search, the code is hard to read. Perhaps we work on different sorts of code.
You start discussing giving variables "meaningful names". In sections you can't refactor.
Occasionally I'll end up with a complex enough loop that's awkward to eliminate by one of the many ways to get rid of a long loop (extract method, helper object, iterator, closure, foreach, etc).
Pretty much every time that happens it's because it's clearer with the code in one place because there's some meaning to things. For example, I might loop through a set of customers, pulling out invoices and looking at individual line items. If it were just a single loop of customers, I'd use just 'i'; that's a common idiom in languages without something like a foreach loop. But using arbitrary letters for all three is confusing, so I'd name them more clearly.
Does that help clarify what I meant?
... and 998 of these functions have one- or two-letter names!
... assuming all 2-letter combinations (ignoring case), 26 x 26 = 676.
... it could be that the gmail code has multiple occurances of the same letter combinations, but using different cases, which would be scary. It's also possible that the same function names are appearing multiple times within the code, perhaps in different scopes (does javascript even have scoping?).
I've never seen the gmail code, but let's do some basic math, shall we?
26 letters in the alphabet
676 2-letter combinations + 26 possibilities for the function names with 1 letter = 702.
702 possible function names, as long as we ignore case. BUT, AFAIK, javascript is a case sensative beast -- function "bb" is not the same at "BB".
998 - 702 = 296.
296 could be a couple of things
Skiers and Riders -- http://www.snowjournal.com
Who wants the javascript before gmail use obfuscate in code
gmail_script.jsuse save as
Links have gone stale! Bloody hell - thought maybe I would join the rest of the world and get a gmail account. Please invite me now before I get stuck with lam3name381382@gmail.com! Fewer and fewer invites these days - checkout http://isnoop.net/gmailomatic.phpGmail Invite Spooler to see my plight. shannonskipper@knology.net (woot - 1meg limit)
I'm sure we'll start seeing better standardization of XMLHttp across different browsers and more stuff like this.
Scuttlemonkey is a troll
This is probably the most overrated, post I've ever read in my life. How many ISPs (ATT, Level3, Above.net, etc.) charge a "per page" fee?
No, you pay for a certain speed (eg 100MBit) and a certain number of gigabytes per month.
It may be obfuscation, but I seriously doubt it. Bandwidth savings are probably part of it, but if you haven't noticed a big thing with google is speed. If there are 1000 functions and they all have short 2 letter names vs. long descriptive names of probably 8 or more characters, they save 6K on the names of their functions alone! That doesn't begin to count the number of times the functions are called within that javascript. They're probably saving upwards of 100K on that script by shortening names of functions.
If I had to guess, it's a combination of bandwidth and, more importantly, speed. Won't someone please think of the dialup users?!
Yes, I am a smart ass; it's better than the alternative.
I was poking fun at your tidbit because these days IDEs will find variables for you without text searches.
dominionrd.blogspot.com - Restaurants on
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
but the JavaScript that can be used in browsers is a very different beast, with a tangled nightmare of quirks, extensions, and compatibility problems.