Thanks T.J.,

Very good suggestions, and it's always interesting to see how other
people (more experienced too) would handle certain things.

What's most interesting to me is that my 'way' of programming has been
to do something like this:

****************************************
var Foo = (function() {
        var Foo = Class.create({
            foo: function() {
               _doSomething(this); // if I am not going to use the
instance
               this.doSomething() // if I am going to use the instance
            },

            doSomething: function() {
              // something with this
            }

         });

        function _doSomething() {
             // something without this
        }

        return Foo;
})();

*******************************************

Where I make "private" methods at the end of my class prefaced with an
_ in the name...  Looking at how you work, it appears you would do
something like this instead:

************************************************
// stuff...
       foo: function() {
               doSomething();
               doSomethingWithThis.bind(this);

               function doSomething() {
                 //something without this
               }

               function doSomethingWithThis() {
                  //something with this..
                }

            }
// stuff...

......

Which is very different for me...  On one hand, I wouldn't need to go
scrolling down to the bottom of my file to look at what those private
methods are doing-- they'd be right there where ever they're being
referenced...  On the other hand, it would mean that my class methods
would end up looking a lot 'bigger'.

> For this, I probably wouldn't use a periodical executer, either,
> because of all the state flags required. I'd probably go with chained
> execution:

I am curious about this...  When you say that about state flags, do
you mean stuff like:
  if (!admin_table.periodical_executer.request_in_progress)

?

Why exactly is 'chained execution' preferred?

> Oh, and I'm a named function guy (I notice you're using an anonymous
> function for your `autoUpdate` property); here's 
> why:http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html

Very interesting also...  Btw, I caught a typo: (that's should be
that)
"Well, okay, that's does work, but it still has some issues:"

Reading that post made me realize how I really don't utilize my
debugging tools...  I don't think I understand them very well.  I use
firebug to test things in the console, and to monitor the html output
that changes dynamically through javascript.  My method of 'debugging'
has been to throw "console.log('here');" at random points in my code
to see if it's reaching that point...

Quite often when there is an error, I am frustrated because I get
messages like "A is null", and I usually say outloud "gee thanks.."
wondering what the hell "A" is..  or the other common error I get is
whatever class I am working on is undefined, and it's usually a
missing semicolon somewhere.  Reading your blog made me say: wow..
I've never been trained to know how to follow a stack trace-- so
named / unnamed functions has never been an issue to me because that
sort of debuggin is just something I have not really understood how to
do.  Do you have any advice on how I can learn this sort of thing?

-patrick

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to