Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Alec Swan

Ranch Hand
+ Follow
since Feb 03, 2005
Alec likes ...
Java jQuery Spring
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alec Swan

Hello,

What are the pros and cons of node.js when compared to a Java backend, such as Jetty? I am looking for something very high-level, e.g. "Use Java for data-intensive processing" or "Learning curve of asynchronous programming for Java developers is very steep". It would be valuable if the answer touched on performance, productivity, adoption and tooling of these two backend technologies.

Thanks,

Alec
Hello,

My company tracks documents in various document repositories. We write custom adapters for each document repo and would like to benefit from a common standard instead.

What popular document repos, such as SharePoint, Outlook, Documentum, Lotus, etc., currently support or committed to support CMIS in the near future? Are commercial companies interested in implementing CMIS or is this primarily a community effort?

Thanks,

Alec
Thank you all for the informative answers.
I saw quite a few different ways to extend jQuery, e.g. through jQuery.extend(), jQuery.fn.extend(), $.extend(true, $[ Namespace ][ pluginName ].prototype, extensionMethods), etc.
Could you post a template that you recommend using for extending jQuery?

Thanks,

Alec

To me that's a cop out. I won't use anything that's buggy by just waving it away and saying "that's the way it is". I'll either find a new plugin, or fix the buggy one to work the way I want.


I might not have been clear in explaining my scenario. Suppose that you develop a perfect plugin A and I develop a buggy plugin Z. Some poor web developer decides to use our plugins on a web page and happens to include Z before A. Then web developer starts testing plugin A, but it doesn't work! He files a bug and you spend half a day (if you are lucky) trying to figure out why your plugin did not work in his environment. You might even end up closing the bug as "not reproducible" pissing off the web developer and losing him as a customer.

All that could have been prevented by making jQuery a little bit smarter in the way it manages event handlers.

If jQuery were to just swallow exceptions, no one would ever get notification that there is a problem. So that's certainly not the answer.


If an unhanded exception occurs in Java, the stack is unwound to point where the system catches it.


Swallowing an exception is one of the worst possible implementations. There are certainly ways to handle errors gracefully and keep handlers independent. Just like in Java where an exception on one thread does not kill all other threads.

Here I will disagree. Why should we tolerate buggy plugins?


Because we live in an imperfect world And buggy plugins make your plugin look bad as I explained in my previous posts.

Let's think of it in terms of the contract on the ready(function) method. What is the contract? Is the function guaranteed to execute? Hmm, only if there were no other handlers registered previously that threw an error. But how can I know if there are such other handlers registered previously? Wouldn't this depend on the order in which the web developer includes JavaScript files in their web page? Ah, so now the contract depends on the order of scripts in the page.

If jQuery handled errors and then surfaced them the contract would have been much simpler - the handler will always be executed.
Sometimes your widget/plugin may be used on a page with a 3rd-party plugin that throws an error in the handler. The bug is in the 3rd-party code, not yours. So, even though your code is bug-free it doesn't work on that page making you look bad!
In general I believe event handlers should be able to work independently.
Why "jQuery should not put try catches around code" in all cases? It's impossible to require every plugin to a be a good citizen. That's why browsers catch JS errors and don't just crash instead.
Except you can't put a try-catch around a third-party handler. It is not a jQuery bug, but jQuery could surely wrap handlers in try-catch effectively solving the problem.
Hello,

In our app we register multiple handlers on $(document).ready(). However, the first handler that throws an error also prevents the execution of subsequent handlers. It would be desirable to execute the rest of the handlers, e.g. in case when the failing handler was registered by some 3rd-party plugin we have no control over.

Has this been fixed in recent jQuery versions or is there a work-around for this issue?

Thanks,

Alec
Great answer, Dave! I like your layering approach.

Thanks!

Alec
6 years ago
Elisabeth,

I expected that some things will still be easier to do with 3-rd party tools than HTML 5. Does the book provide recommendations on when to use HTML 5 and when to use other tools to implement a certain functionality or does the book focus exclusively on how to do things with HTML 5?

Thanks,

Alec

Being able to express your thoughts clearly is different from having good social skills. In fact, most of architects that I admire have extensive vocabularies and presenting skills.
Sometimes I am worried when we have to take architects on customer sites because they can come across as cocky and patronizing. But surprisingly such behavior seems to make customers feel more secure.
I better get a copy of your book and see how this outcome can be achieved through other types of behavior.
6 years ago
I was expecting that - made me an easy target I think the question still stands even without numeric quantification.
6 years ago
How much do new features introduced in HTML 5 overlap with features jQuery and MooTools? Which parts of these libraries, such as jQuery animation, do you see HTML 5 features will replace?

Thanks
Hello,

I know some great architects who have very limited social skills but sound confident (read cocky) when they talk about technology and you can tell they know what they are talking about. This sort of attitude often times instills confidence.

I think it is important for anybody to have good social skills. But how important are social skills vs technical skills to a software architect 10/90, 20/80, 30/70?

Thanks
6 years ago