Show simple item record

dc.contributor.authorYuning, Yu 20:46:41 (GMT) 20:46:41 (GMT)
dc.description.abstractTraditional object-oriented languages use typed classes to specify the shape and behaviour of objects. In JavaScript, object behaviour is less constrained. Learning how JavaScript programmers create objects can help us understand whether the programmers employ the notion of ``classes'', like those in Java, in JavaScript. In other words, we are trying to compare the creation of objects in JavaScript with Java classes, which create objects and describe the state and behaviour that the type of the object support. Our results have the potential to improve the performance of JavaScript and generality of typed extensions to JavaScript. An access site is the JavaScript code that accesses the properties of objects. We studied the access site to determine whether objects at the access site arise from different ``creators'', which are functions creating the objects, and to discover how prevalent multiple-creator access sites are. Moreover, whether the types of properties ever change is noteworthy: in classes, types of properties may not change. To answer the questions, we executed, recorded, and analyzed many JavaScript applications to obtain real-world data. We collected and analyzed logs from 7,753 web sites. The logs consist of nearly 390 GB of JSON strings. We collected these data through dynamically running modern JavaScript applications, or web sites, in our tool with the browser Firefox. Our results show that for half of selected web sites, there exists only one creator at every access site. And in fewer than 50\% of web sites, there exists more than one creator, though the total number of access sites with multiple creators is extremely small. Although creators with distinct names are considered as different by our definition, different creators may create same objects. Therefore, most object accesses in JavaScript do not come from different creators. As a result, we could employ type annotations for objects. However, our results show that the types of the properties in objects do sometimes change, especially in objects generated from user-defined functions. Thus, even if objects are mostly from one creator, that creator may not correspond neatly to a type. This may limit the advantages of using types for better performance. Combining these results, we conclude that while we can apply Java-like types to JavaScript, these types are far more fluid in JavaScript applications, and so there may be limited benefit.en
dc.publisherUniversity of Waterlooen
dc.titleA study of object creators in JavaScripten
dc.typeMaster Thesisen
dc.pendingfalse R. Cheriton School of Computer Scienceen Scienceen of Waterlooen
uws-etd.degreeMaster of Mathematicsen
uws.contributor.advisorGregor, Richards
uws.contributor.affiliation1Faculty of Mathematicsen

Files in this item


This item appears in the following Collection(s)

Show simple item record


University of Waterloo Library
200 University Avenue West
Waterloo, Ontario, Canada N2L 3G1
519 888 4883

All items in UWSpace are protected by copyright, with all rights reserved.

DSpace software

Service outages