Programming

What Is Readability In SAPUI5 Code?

Code that is easy to understand and maintain is considered “clean.” When someone is working with code, it should be clear as to what it does and how it works.

 

Clean code provides developers the ability to extend the code and fix bugs since it’s built to withstand changes that won’t break existing functionality. The concepts used to write clean code allow developers to create better programs, which can be extended to any programming language. One of the fundamental values of clean SAPUI5 is readability.

 

Readability

The idea of readable code is that it can be understood easily and quickly.

 

There are languages that don’t necessarily offer the opportunity to write understandable code that can be comprehended quickly, since they’re limited to lower levels of detail functionality– this is not the case with SAPUI5. However, to take advantage of its capabilities, developers still need to learn how to write detailed code that is easy to understand.

 

For example, a statement like t = 42 is difficult for a reader to understand. It would be a time-consuming process for them to figure out that “t” stands for timeout, and that the number “42” is the duration in seconds. There needs to be more detail here to provide some context for the reader. To make this statement cleaner, the equivalent would read TimeoutInSeconds = DEFAULT_TIMEOUT.

 

While the detail in code is a huge factor of readability, it’s important to be mindful of how concise it is. If developers are looking at a copious amount of convoluted detail, it’s challenging to see the big picture and it’ll take up a lot of time to essentially de-code the code. Since people are reading code far more often than they’re writing it – whether rereading your own code during the debugging process, extending it with new features, or reading other developers’ code in reviews, support tickets, or when connecting new components – it’s vital to invest time into writing precise and simplified code so the reading portion can be more efficient and productive.

 

In addition to saving time, readable code is easier to verify, which means it’s harder to misinterpret. Code reviewers can spend less time on figuring out what the code means and its functionality, and more time on other important aspects. Clean code can also be debugged quicker than “dirty” code, and the fact that it’s clean means there are fewer bugs to deal with.

 

About the Clean SAPUI5 Book

Ready to write cleaner code? We’ve published our Clean SAPUI5 style guide to help developers get started with building their skills to create better programs.

 

Begin with an introduction to the clean SAPUI5 concept and its relation to JavaScript. Then learn how to structure a project for various project types and the different artifacts involved.

 

The next chapter explores why controller modules grow quickly in SAPUI5 applications, and offers strategies to achieve proper decoupling. Next, understand JavaScript functions and key concepts such as types of functions, function parameters, and how to structure the function body. You’ll also get to know guidelines on naming, how to declare and use variables and literals, control flows, error handling, formatting, and comments.

 

Learn about ESLint and how the linter can help a developer build cleaner code. The book then covers testing principles and shows you how to design and run unit, component, and integration tests on your JavaScript code.

 

You’ll explore the motivation for a number of significant technologies incorporated in the SAPUI5 ecosystem. Close out the book with a discussion on challenges and approaches to establishing clean SAPUI5 practices.

 

Who Is This Book For?

This style guide is for SAPUI5/JavaScript developers who want to create better programs with cleaner code. It is beneficial for learners of all levels–from novice to expert–and is also encouraged for architects looking to understand clean SAPUI5.

 

About the Author

Daniel Bertolozi is a software developer at SAP with more than five years of experience focused on SAP Fiori development. He has worked on several projects implementing SAPUI5 applications (in JavaScript and TypeScript) applying best practices for code quality, and he is actively engaged in disseminating agile software engineering practices around SAP. Daniel's approach to software development follows Robert C. Martin's phrase: "The only way to go fast, is to go well."

 

Arnaud Buchholz is a development expert at SAP, with a focus on designing, developing, and enhancing SAPUI5 applications. He has more than 20 years of experience in software development.

 

Klaus Haeuptle is a lead architect, servant leader, coach, and community lead. During his career at SAP, he has worked as a developer and architect on several products based on various technologies. Additionally, he facilitates communities across SAP with the intention of sharing knowledge and improving practices, tools, technologies, and culture. He has influenced many improvements on testability for ABAP, SAP HANA, SAPUI5, and other technologies.

 

Rodrigo Jordão is a development architect at SAP currently working on supply chain management and related solutions. He has spent his SAP career working on various SAP products, from industry-specific solutions like intellectual property management to foundational products like sales and distribution. Prior to joining SAP, he worked as a web developer with Perl and Java and as a consultant with Microsoft technologies.

 

Christian Lehmann is a development architect working in the SAP S/4HANA quality area. During his 16 years at SAP, he has worked on the design, implementation, and test automation of SAP-based products, including applications based on SAPUI5. He is a contributor to the SAP ASE community for ABAP and SAPUI5 topics, and enjoys experiencing new approaches for automated software testing.

 

Narendran N V is a senior developer, trainer, and security expert at SAP. Currently, he is part of a team that is focused on building advanced available-to-promise (ATP), which is an integral part of order fulfillment in SAP S/4HANA. Previously, he was part of the FXperience (Bangalore) team, which accelerates SAP Fiori adoption within SAP S/4HANA. Narendran believes that “knowledge is like a garden; if it is not cultivated, it cannot be harvested," so he makes time to coach teams on topics like agile software engineering, SAPUI5 and SAP Fiori elements, and recently, the ABAP RESTful application programming model. Prior to SAP, he worked with IBM as a consultant, contributing to custom development in the areas of travel & expense and finance.

 

How to Purchase

If you’re interested in purchasing Clean SAPUI5: A Style Guide for Developers, follow this link and choose the format that works best for you: e-book, print edition, or bundle (both e-book and print).

 

If you want to continue learning about SAPUI5, or if you want information on other upcoming books or special offers, make sure to sign up for our topic newsletters or our weekly blog recap.

Recommendation

Clean SAPUI5: A Style Guide for Developers
Clean SAPUI5: A Style Guide for Developers

SAPUI5 code needs to be easy to read and easy to update. Clean up your code with this guide from the experts! Learn how to leverage JavaScript features to write better SAPUI5 code. Then walk through detailed code examples and explanations for using modules, classes, functions, names, variables, literals, comments, code metrics, and more. Get the best practices you need for formatting, testing, implementation, and beyond!

Learn More
SAP PRESS
by SAP PRESS

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!

Comments