RSS
 

Posts Tagged ‘javascript’

The Problem with TodaysMeet

29 Jan

TodaysMeet is a project I started in 2008 to help my father solve a problem in one of his classes. The fact that it’s as popular as it is—mostly in education—never ceases to amaze me.

Unfortunately, I don’t give TodaysMeet the attention it, and more importantly its users, deserve. This is because TodaysMeet has two fatal flaws that, if they haven’t crippled it yet, will someday.

  • The UI is based on proof-of-concept JavaScript.
  • The back-end is based on my own framework.

What follows is the sad history of TodaysMeet development.

Origin Story

TodaysMeet came out of a conversation between my father and I, but it’s origins are slightly older. In some downtime in late 2007 I was trying to familiarize myself with various JavaScript frameworks by writing a UI for the same back-end in each of them. It was a pretty basic Ajax comment system. I believe it polled the server every minute. If I remember correctly, I got busy and abandoned it after creating Prototype and jQuery versions.

Around the same time I was enamored of Rails, and trying to round out Maveric into a decent Rails-inspired PHP framework.

So when my father said he wanted something like Twitter for a single classroom, that he could project on a wall, and wouldn’t require signing up, I put these things together in my head. TodaysMeet is basically the proof-of-concept Prototype JS running on top of an old version of Maveric.

The Situation Now

Every developer should write a framework, I think it’s a fantastic learning experience. But they should never build a production website out of it.

Even though Maveric got a little better after I created TodaysMeet, it’s still based on an untested, unsupported framework with no support for basic things like storage back-ends or caching.

The UI is still based on Prototype, which I haven’t used in years, and the fundamental client-server interactions are still that original “learning the library” code.

Essentially, TodaysMeet is a prototype masquerading as a production-ready product.

The result is that working on it is slow, difficult, and frankly unpleasant. Adding features—like the long-promised password protected rooms—is painful and, with no test suite, dangerous. The one real feature I added, Twitter integration, barely works when it works at all.

But users don’t care about any of that. They see that it works, mostly. They might see that it doesn’t get much attention and the UI feels three years old (because it is, of course).

Where Do We Go From Here?

TodaysMeet could be awesome, but it needs to go all the way down to the basic stack and get rebuilt. TodaysMeet is an absolutely perfect candidate for all sorts of new, exciting tools and techniques. To use any of them means starting over.

This is the first of a two-part post. In the next part, I’m going to outline the architecture I want, instead of the architecture I have.

Hopefully, some social aspect of talking about this will lead to me actually doing something about it.

 
3 Comments

Posted in Articles

 

JavaScript: Private Static Members, Part 2

19 May

Finally, it’s time to finish up the lesson on private static members and methods in JavaScript.

Last time, I introduced the technique of creating and immediately executing a function, using parentheses. I talked a little about returning a function and storing it in a variable.

  1. var myFunc = (function () {
  2.   return function () {
  3.     alert("Hello, World!");
  4.   }
  5. })();
  6.  
  7. alert(myFunc); // "function () … "
  8.  
  9. myFunc(); // Hello, World!

Read the rest of this entry »

 
Comments Off

Posted in Articles

 

JavaScript: Private Static Members, Part 1

28 Apr

A little while ago I talked about creating private variables and methods in JavaScript. This works, but is not necessarily efficient: each instance of the class creates new copies of the members. While that may be exactly what you want for instance variables (think of partNum in the old examples) it is not always ideal.

The complexity jumps significantly, though. So I’m dividing this half into two parts.

To get started, we need to forget about all this Object-Oriented Programming for a minute and look at some of the neat tricks you can do with functions in JavaScript.

Update: Part 2 is now available. Read the rest of this entry »

 
Comments Off

Posted in Articles

 

Firefox: Open in Blank Tab

22 Apr

If you don’t use Firefox 3, go get it. Then finish this article. (Safari and Opera users are excused, but there’s no promise this will work for them.)

One of my (few) gripes with Firefox is that bookmarks on the toolbar have no “open in blank tab” option. They have an “open in sidebar” option, but those uses are rare and esoteric at best. Personally, I never use the sidebar.

“Open in blank tab” should basically do this: if there is a blank tab, use it; if not, create a new tab. Frankly, it could just open in a new tab regardless, but it seems like such an easy thing to add.

But? It can’t be done directly in Firefox. Hence, I present this small script:

  1. javascript:
  2. (function(){var u=‘http://mail.google.com/mail’;
  3.   if(window.location==‘about:blank’){
  4.     window.location=u;
  5.   }else{
  6.     window.open(u,);
  7.   }
  8. )();

That’s it. Try dragging this link to GMail to your bookmark toolbar. Then click the link on your toolbar. Now, open a new tab, and click the link again.

This isn’t exactly what I asked for. It has no way of knowing if any blank tab exists, only if the current tab is blank. And, of course, it lacks the nice favicon support.

But it does the job. If you change the variable u to something other than ‘http://mail.google.com/mail’, you can make the link open any other page.

I love anonymous functions.

Update: If you want a bookmark for something besides GMail, you can create your own. Or you can drag this link to your toolbar, to make new ones whenever you want: Open in Blank Tab.

Update 2: Oops, fixed the “create your own” link. Tested it, then accidentally pasted in the results, instead of the actual script.

 
1 Comment

Posted in Articles

 

Private Variables in JavaScript

10 Feb

Ok, enough of this social/ranting stuff. Time to write something vaguely technical.

I have a love-hate relationship with JavaScript. I think anyone who works with it does. Sometimes it just doesn’t do what you expect, and it’s certainly different.

One trick, especially for people from real Object-Oriented languages like Java, Ruby, or let’s even say PHP 5, is the lack of access control. When everything is an object, the inability to hide certain values can become a problem. Read the rest of this entry »

 
Comments Off

Posted in Articles