Evaluation of the Blazor Framework
Total Page:16
File Type:pdf, Size:1020Kb
Evaluation of the Blazor framework A comparison between Blazor and React Main Subject area: Computer Engineering Author: Emil Persson, Oliver Köping Supervisor: Denis Golubovic JÖNKÖPING 2021 07 01 This final thesis has been carried out at the School of Engineering at Jönköping University within Computer Engineering. The authors are responsible for the presented opinions, conclusions and results. Examiner: Florian Westphal Supervisor: Denis Golubovic Scope: 15 hp (first-cycle education) Date: 2021-07-01 i Abstract Blazor WebAssembly is a new framework that was released in May 2020 that makes it possible to build client-side web applications using C# instead of using JavaScript for its frontend. The most popular web frameworks today are JavaScript based frameworks. This study aims to find out if Blazor is a viable option to use for developing web applications and if it is a well-established framework compared to JavaScript frameworks. To evaluate Blazor, a comparison is performed between Blazor and React on six criteria. The criteria are lines of code, cyclomatic complexity, state management, debugging tools, community, and libraries. To answer the criteria two applications was developed, one in the React framework and one in the Blazor framework. Besides the two applications, literature was gathered to answer the criteria. The results from the comparison showed Blazor was a Viable option to use for the development of web applications and that it has become established as a framework when taken its age in to consideration. Keywords: React, Blazor, WebAssembly, JavaScript, C#, web framework, development. ii Table of content Abstract .......................................................................................... ii Table of content ............................................................................ iii 1 Introduction ............................................................................. 1 1.1 COMPANY BACKGROUND ................................................................................. 1 1.2 PROBLEM STATEMENT ...................................................................................... 1 1.3 PURPOSE AND RESEARCH QUESTIONS ............................................................... 2 1.4 SCOPE AND LIMITATIONS .................................................................................. 2 1.5 DISPOSITION ..................................................................................................... 2 2 Background .............................................................................. 2 2.1 C# .................................................................................................................... 2 2.2 WEB FRAMEWORK ............................................................................................ 3 2.3 BLAZOR ............................................................................................................ 3 2.4 WEBASSEMBLY ................................................................................................ 3 2.5 LIBRARY .......................................................................................................... 4 2.6 JAVASCRIPT ..................................................................................................... 4 2.7 REACT .............................................................................................................. 4 2.8 REDUX ............................................................................................................. 4 3 Method and implementation .................................................. 5 3.1 CRITERIA FOR COMPARISON ............................................................................. 5 3.2 EVALUATION CRITERIA .................................................................................... 6 3.2.1 Applications ............................................................................................. 6 3.2.2 Lines of code ............................................................................................ 7 3.2.3 Cyclomatic complexity ............................................................................ 7 3.2.4 State management .................................................................................... 8 iii 3.2.5 Libraries ................................................................................................... 9 3.2.6 Community ............................................................................................ 10 3.2.7 Debugging tools ..................................................................................... 11 3.3 VALIDITY AND RELIABILITY ........................................................................... 11 4 Results ..................................................................................... 12 4.1 LINES OF CODE ............................................................................................... 12 4.2 CYCLOMATIC COMPLEXITY ............................................................................ 13 4.3 STATE MANAGEMENT ..................................................................................... 13 4.4 LIBRARIES ...................................................................................................... 13 4.5 COMMUNITY .................................................................................................. 14 4.5.1 Stack Overflow questions ...................................................................... 14 4.5.2 Github repositories ................................................................................. 15 4.5.3 Github contributors ................................................................................ 16 4.5.4 Github repository stars ........................................................................... 17 4.6 DEBUGGING TOOLS ........................................................................................ 18 5 Discussion ............................................................................... 20 5.1 RESULT DISCUSSION ....................................................................................... 20 5.1.1 Lines of code .......................................................................................... 20 5.1.2 Cyclomatic complexity .......................................................................... 20 5.1.3 State management .................................................................................. 21 5.1.4 Libraries ................................................................................................. 21 5.1.5 Community ............................................................................................ 21 5.1.6 Debugging tools ..................................................................................... 22 5.2 METHOD DISCUSSION ..................................................................................... 22 6 Conclusions and future research .......................................... 24 6.1 CONCLUSIONS ................................................................................................ 24 6.2 FUTURE RESEARCH ......................................................................................... 25 iv 7 References .............................................................................. 26 8 Appendixes ............................................................................. 30 8.1 APPENDIX A ................................................................................................... 30 8.2 APPENDIX B ................................................................................................... 35 v 1 Introduction 1.1 Company background Saab Training and Simulation is a subsidiary of Saab AB that produces military and security training systems for a variety of military forces. The branch that this thesis is conducted on is the branch that works with developing applications that supports the training of military personnel. Saab has interest in exploring if Blazor is a viable option to use for front-end web development. The language that is used at Saab for development is mainly C# and therefore Saab wants to explore the Blazor framework which is based on C#. 1.2 Problem statement In May 2020 Blazor web assembly was released by Microsoft which makes it possible to build client web applications using C#. Blazor web assembly allows applications to be built using C# instead of previous applications that relied on JavaScript for its front- end. C# is to date the 4th most popular programming language and has approximately 31% of all developers using it to some extent. C# has the 3rd largest community on Stack Overflow (Mkhitaryan, 2021). This shows that Blazor is worth researching in, since it could have a big impact on many developers. At the time of writing there is not much research conducted on Blazor and this leaves a gap to find out what advantages and disadvantages Blazor have compared to other well- established frameworks, e.g., Angular, React and Vue. Previous research that has been conducted has focused mainly on measuring the performance of Blazor, for example application loading times, performance in calculations and operations. (Kozak, 2020; Suryś, 2019). In a recent study Blazor was compared with Angular on nine different criteria to find out how Blazor stands up to its competitors (Sandberg, 2021). This study shows that Blazor is a new framework that needs to be researched about and compared against other frameworks. It is relevant that more research is performed