A comparison of functional and object-orientedprogramming paradigms in JavaScript
2017 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE credits
Student thesis
Abstract [en]
There are multiple programming paradigms that have their own set rules forhow code should be written. Programming languages utilize one or multiple ofthese paradigms. In this thesis, we will compare object-oriented programming,that is the most used today with languages such as C++ and Java, and functionalprogramming. Functional programming was introduced in the 1950's butsuered from performance issues, and has not been used much except for in theacademic world. However, for its ability to handle concurrency and big data,functional programming is of interest in the industry again with languages suchas Scala. In functional programming side effects, any interaction outside of thefunction, are avoided as well as changing and saving state.
To compare these paradigms we have chosen four dierent algorithms, whichboth of us have implemented twice, once according to object-oriented programmingand once according to functional programming. All algorithms were implementedJavaScript. JavaScript is a multiparadigm language that supportsboth functional and object-oriented programming. For all implementations,we have measured development time, lines of code, execution time and memoryusage. Our results show that object-oriented programming gave us betterperformance, but functional programming resulted in less code and a shorterdevelopment time.
Place, publisher, year, edition, pages
2017. , p. 48
Keywords [en]
Functional programming, Object-oriented programming, Comparison, Programming paradigms, JavaScript
National Category
Computer Systems
Identifiers
URN: urn:nbn:se:bth-14717OAI: oai:DiVA.org:bth-14717DiVA, id: diva2:1115428
Subject / course
PA1445 Kandidatkurs i Programvaruteknik
Educational program
PAGPT Software Engineering
Supervisors
Examiners
2017-06-282017-06-262017-06-28Bibliographically approved