We hope that you liked this e-book. Please share your feedback with us and read the to find out how to contact us.
Dear Reader,
Spring cleaning . As the weather gets warmer and we break out the lemonade and enjoy the flowers in bloom, many of us are reminded of a decidedly less enjoyable tradition. Spring is the time to dedicate a few days to getting rid of all the built-up dust and grime that you might not tend to during regular tidying. Dusting the ceiling fans, vacuuming curtains, washing out window screens, scrubbing the oven, rotating mattressesthe list goes on.
As much as I enjoy a sparkling clean home, I do not enjoy dealing with the mess. Deeper cleaning on a regular basis could reduce the eventual spring cleaning, but avoiding it altogether is impossible. Dust will always continue collecting, despite our best efforts!
Luckily, the world of programming is different. While messy code can certainly build up until its a pain to deal with, there is a way to prevent it in the first place: clean code practices. By following clean SAPUI5 guidelines, your code will be easy to understand and maintain. In this style guide, youll get the best practices and practical examples you need to write sparkling clean SAPUI5 code, straight from expert SAPUI5 developers.
What did you think about Clean SAPUI5: A Style Guide for Developers ? Your comments and suggestions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have.
Thank you for purchasing a book from SAP PRESS!
Megan Fuerst
Editor, SAP PRESS
www.sap-press.com
Rheinwerk Publishing Boston, MA
Notes on Usage
This e-book is protected by copyright . By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the internet or in a company network is illegal as well.
For detailed and legally binding usage conditions, please refer to the section .
This e-book copy contains a digital watermark , a signature that indicates which person may use this copy:
Notes on the Screen Presentation
You are reading this e-book in a file format (EPUB or Mobi) that makes the book content adaptable to the display options of your reading device and to your personal needs. Thats a great thing; but unfortunately not every device displays the content in the same way and the rendering of features such as pictures and tables or hyphenation can lead to difficulties. This e-book was optimized for the presentation on as many common reading devices as possible.
If you want to zoom in on a figure (especially in iBooks on the iPad), tap the respective figure once. By tapping once again, you return to the previous screen. You can find more recommendations on the customization of the screen layout on the .
Preface
JavaScript is an immensely powerful language, but with this power come additional sources of problems. Therefore, having a codebase that is readable, maintainable, and especially testable is essential for sustainable development. The book Clean Code: A Handbook of Agile Software Craftsmanship from Robert C. Martin and several other books contain many best practices to achieve this goal in Java, but many of the concepts described are independent of the programming language. Clean code is a core part of agile software engineering and ensures that you can stay agile in the long run and can easily adapt your projects to constantly changing needs and requirements.
Since the time spent reading code is much higher than the time spent writing that same piece of code, a critical goal is that your code be easy to read and clearly convey what its trying to achieve. With a relentless focus on readability, clean code ultimately impacts the maintainability of the codebase.
In this book, well describe rules, practices, principles, patterns, guidelines, and recommendations on how to make your SAPUI5/JavaScript code cleanthat is, readable, understandable, maintainable, and testable. This book explains code patterns and idioms as well as covers more high-level design considerations. Well also explore habits, processes, and organizational concerns that impact the implementation of clean code as an individual developer and as a team.
Note
Many developers switch between languages and frameworks. This book uses the same language and terminology as the book Clean ABAP: A Style Guide for Developers (SAP PRESS, 2021, www.sap-press.com/5190 ), when meaningful. Therefore, readers of Clean ABAP: A Style Guide for Developers can benefit from an easier learning process, focusing on known concepts and then exploring differences. Similarly, if you start with this book, youll benefit from the shared structure of these two books to become familiar with Clean ABAP . Many of the concepts in Clean ABAP should be familiar, so you can focus on applying these principles to ABAP. Still, be aware that major differences exist between ABAP and JavaScript, and no conceptual overlap exists between the two books.
Who This Book Is For
This book is rather technical in nature and is mainly written for SAPUI5/JavaScript engineers. We included many code samples to make the adoption of principles and practices easier. We provide sufficient explanation for novice-level readers while also including lots of interesting content for senior- to expert-level engineers. Depending on your skill level, you may benefit from different topics or feel drawn towards specific areas of focus. However, the general ideas contained in this book address all developers, independent of experience.
We encourage architects to read this book to understand clean SAPUI5. Some topics in this book intersect with architecture (e.g., modularization). Even if you dont code at all, you can benefit, learn, and apply some of these practices. In particular, the last chapter is not only relevant for engineers, but for Scrum masters and managers as well since they must take care of team and organizational development.