Skip to main content
deleted 37 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

What's wrong with this javascript programming approach? Instant messaging system

Helllo people I'm now developing an instant messaging system but I'm a little confused  : I can't decide which approach do I have to choose!

Here is a code and I want you to tell me what is good/bad with this programming approach: one. One friend of mine said it's difficult to read, but Itit 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

psP.S: for visibility sake, I added some space between line separating objects' properties.

What's wrong with this javascript programming approach?

Helllo people I'm now developing an instant messaging system but I'm a little confused  : I can't decide which approach do I have to choose!

Here is a code and 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

ps: for visibility sake, I added some space between line separating objects' properties

Instant messaging system

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.

deleted 37 characters in body
Source Link
Joseph
  • 25.2k
  • 2
  • 25
  • 37

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose!

Here is a code and 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

ps: for visibility sake, I added some space between line separating objects' properties

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose!

Here is a code and 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

ps: for visibility sake, I added some space between line separating objects' properties

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose!

Here is a code and 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

ps: for visibility sake, I added some space between line separating objects' properties

Source Link
Bellash
  • 129
  • 4

What's wrong with this javascript programming approach?

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose!

Here is a code and 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

ps: for visibility sake, I added some space between line separating objects' properties