Search |
||
What's your opinion of JavaScript?I use it and I like it
30% (227 votes)
I use it and I don't like it
37% (284 votes)
I don't use it, but I'd like to
8% (61 votes)
I don't use it, and don't want to
23% (179 votes)
Something else (please comment)
2% (12 votes)
Total votes: 763
»
|
||
|
|
Javascript is Good!
//if page is found if(myRegExp.test(_requestSpec)){ var _templateDefinition = "file:///" + _root + page.@template; var template = eval("(" + read(_templateDefinition) + ")"); //load the template definition var _body = ; var stack = 0; for (var j = 0; j < page.subscription.length(); j++) { var _subscriptionId = page.subscription[j].@id; var _fragmentId = page.subscription[j].@node; //meta template method!! this is why javascript is being used. this is so simple and elegant var _subcription = template..div.(@['id'] == _subscriptionId); if(_subcription.toXMLString().length > 0){ var _contentUri = "file:///" + _root + _fragmentId; var content = eval("(" + read(_contentUri) + ")"); //load the content template..div.(@['id'] == _subscriptionId).* += content.*;//append the content to the template fragment } } _body.* = template.*; print(_body); }I can't explain how happy i was when i finished this code. Everything is succinctly parameterized. On the down side, I do get the feeling this code is not self explanatory. I haven't gotten to a place where I feel I can write maintainable code and I am sort of skirting a place where there is a danger I might not be able to understand my own code. I haven't gotten there yet but Its quite possible to get carried away and do just that with Javascript but moderately hard to do in Java.The merits of JavaScript wouldn't be obvious to Object Oriented
Ok Language, Shame About The Environment
Ok Language, Shame About The Environment
Ok Language, Shame About The Environment
JavaScript for the front-end
Don't bet against Javascript!
Don't bet against Javascript!