I'm now developing an instant messaging system but I'm a little confused: I can't decide which approach I have to choose!
I want you to tell me what is good/bad with this programming approach. One friend of mine said it's difficult to read, but it works.
/*! | (c) 2012, 2013 by Bellashh*/
/// <reference path="jquery-2.0.0-vsdoc.js" />
$(document).ready(function () {
var ChatProvider = {
"Friends": [],
"People": [],
"Conferences": [],
"UI": {},
"Utils": {
"functions": {
"alert": function (str) {
alert(str);
} /*ChatProvider.Utils.functions.alert*/ ,
"addFriend": function (friend) {
ChatProvider.Friends.push(friend);
alert(ChatProvider.Friends.pop().Names);
} /*ChatProvider.Utils.functions.addFriend*/ ,
} /*ChatProvider.Utils.functions*/ ,
"events": {} /*ChatProvider.Utils.events*/ ,
"settings": {
} /*ChatProvider.Utils.settings*/
}
} //var ChatProvider
ChatProvider.Utils.functions.addFriend({
"Names": "bellash"
});
}); //$(document).ready
P.S: for visibility sake, I added some space between line separating objects' properties.
Friends
,People
andConferences
? Do we get them through a function or do we access the arrays directly? \$\endgroup\$addFriend
pushes something onto theFriends
array and then immediately pops it back off, which makes no sense, and thealert
function seems contrived; it just wrapswindow.alert
. In other words, it wouldn't do much good to review this code, as the code doesn't do anything useful. \$\endgroup\$