I am currently working on an HTML5 / JS mobile project, and I have just added a set of β40 requestsβ classes to the JS infrastructure for a clearer client-server communication. My boss questioned the use of so many classes because he thinks we might run into future problems with the number of variables and functions defined immediately. My argument is that we should write for intelligibility first and worry about optimization in the future when this becomes a problem.
So my question is, is this concern justifiable - is there a (rather low) limit on the number of variables and functions that can be defined right away, and does it depend on each browser or device basis?
Edit:
An example request file is as follows, where JSONRequest is the "extension" of AbstractRequest:
function MyServerRequest(content, info, otherData, callback, ignoreErrors) { var requestData = new RequestData("MyServerRequest"); requestData.messageType = MyConst.MY_END_POINT; requestData.message = { something: content, anotherthing: { blah: info } thirdthing: otherData }; JSONRequest.call(this, requestData, callback, ignoreErrors); } MyServerRequest.prototype = Object.create(JSONRequest.prototype); MyServerRequest.prototype.constructor = MyServerRequest;
source share