Clean SAPUI5
- 0 %

Clean SAPUI5

A Style Guide for Developers
Sofort lieferbar | Lieferzeit: Sofort lieferbar I
Alle Preise inkl. MwSt. | Versandkostenfrei
ISBN-13:
9781493222285
Veröffentl:
2022
Erscheinungsdatum:
01.01.2023
Seiten:
530
Autor:
Daniel Bertolozi
Gewicht:
1292 g
Format:
260x185x36 mm
Serie:
SAP Press
Sprache:
Englisch
Beschreibung:

Daniel Bertolozi is a software developer at SAP, with more than 5 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". If quality decreases, speed eventually will too, and that's what we want to avoid.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 integrated business planning (IBP) with a focus on SAP Supply Chain Control Tower. He has spent his SAP career working on various SAP products, from industry-specific solutions like SAP 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-based topics and enjoys experiencing new approaches for automated software testing.Narendran NV 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 the order fulfillment processes in SAP S/4HANA. Before, he was part of FXperience (Bangalore) team that 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.
Create descriptive program names, write strong comments, and format code correctly
... Preface ... 17

... Who This Book Is For ... 17

... How This Book Is Organized ... 18

... Acknowledgments ... 20

... Conclusion ... 22

1 ... Introduction ... 23

1.1 ... What Is Clean SAPUI5? ... 23

1.2 ... How to Get Started with Clean SAPUI5 ... 26

1.3 ... How to Handle Legacy Code ... 27

1.4 ... How to Check Code Automatically ... 29

1.5 ... How Does Clean SAPUI5 Relate to Other Guides? ... 29

1.6 ... Summary ... 30

2 ... JavaScript and SAPUI5 ... 31

2.1 ... JavaScript ES6+ Features ... 32

2.2 ... TypeScript ... 106

2.3 ... Summary ... 117

3 ... Project Structure ... 119

3.1 ... Components in SAPUI5 ... 119

3.2 ... Important Artifacts ... 122

3.3 ... Freestyle Applications ... 129

3.4 ... SAP Fiori Elements ... 132

3.5 ... Library Projects ... 139

3.6 ... Model-View-Controller Assets ... 142

3.7 ... Summary ... 144

4 ... Modules and Classes ... 147

4.1 ... Controller Inflation ... 148

4.2 ... Module Lifecycle ... 179

4.3 ... Reusability and Testability ... 187

4.4 ... Service Modules versus Class Modules ... 197

4.5 ... Summary ... 204

5 ... Functions ... 205

5.1 ... Function Definition ... 205

5.2 ... The Function Object ... 206

5.3 ... Instance Methods ... 208

5.4 ... Event Handlers and Callbacks ... 211

5.5 ... Callback Execution Context ... 211

5.6 ... Getters and Setters ... 213

5.7 ... Anonymous Functions ... 215

5.8 ... Function Parameters ... 217

5.9 ... Promises ... 230

5.10 ... Generators ... 236

5.11 ... Function Body ... 237

5.12 ... Invoking Functions ... 245

5.13 ... Closures ... 247

5.14 ... Summary ... 248

6 ... Naming ... 249

6.1 ... Descriptive Names ... 249

6.2 ... Domain Terms ... 251

6.3 ... Design Patterns ... 252

6.4 ... Consistency ... 253

6.5 ... Shortening Names ... 254

6.6 ... Noise Words ... 255

6.7 ... Casing ... 255

6.8 ... Classes and Enums ... 257

6.9 ... Functions and Methods ... 258

6.10 ... Variables and Parameters ... 260

6.11 ... Private Members ... 265

6.12 ... Namespaces ... 267

6.13 ... Control IDs ... 268

6.14 ... Hungarian Notation ... 270

6.15 ... Alternative Rules ... 271

6.16 ... Summary ... 273

7 ... Variables and Literals ... 275

7.1 ... Variables ... 275

7.2 ... Literals ... 279

7.3 ... Summary ... 297

8 ... Control Flow ... 299

8.1 ... Conditionals ... 299

8.2 ... Loops ... 303

8.3 ... Conditional Complexity ... 306

8.4 ... Summary ... 313

9 ... Error Handling ... 315

9.1 ... throw and try/catch Statements ... 315

9.2 ... Using Error Objects ... 317

9.3 ... Error Handling Using Messages ... 318

9.4 ... Error Handling Using Controls ... 320

9.5 ... Error Handling Best Practices ... 323

9.6 ... Summary ... 327

10 ... Formatting ... 329

10.1 ... Motivation ... 329

10.2 ... Vertical versus Horizontal Formatting ... 330

10.3 ... Indentation ... 339

10.4 ... XML Views ... 341

10.5 ... Additional Considerations ... 347

10.6 ... Formatting for TypeScript in SAPUI5 ... 351

10.7 ... Building and Maintaining a Code Style Guide ... 361

10.8 ... Formatting Tools ... 363

10.9 ... Summary ... 368

11 ... Comments ... 369

11.1 ... Express Yourself in Code ... 369

11.2 ... The Good: Comment Placement and Usage ... 371

11.3 ... The Bad: Comments to Avoid or Refactor ... 381

11.4 ... The Ugly: Special Comments ... 391

11.5 ... Summary ... 394

12 ... Static Code Checks and Code Metrics ... 397

12.1 ... Linting ... 399

12.2 ... Code Metrics ... 417

12.3 ... Summary ... 437

13 ... Testing ... 439

13.1 ... Principles ... 440

13.2 ... Code under Test ... 451

13.3 ... Injection ... 453

13.4 ... Test Methods and Journeys ... 458

13.5 ... Test Data ... 461

13.6 ... Assertions ... 464

13.7 ... Summary ... 470

14 ... TypeScript and Related Technologies ... 471

14.1 ... TypeScript ... 471

14.2 ... Web Components ... 485

14.3 ... Fundamental Library ... 494

14.4 ... Summary ... 498

15 ... Implementing Clean SAPUI5 ... 499

15.1 ... A Common Understanding among Team Members ... 499

15.2 ... Collective Code Ownership ... 500

15.3 ... Clean Code Developer Initiative ... 501

15.4 ... Tackling the Broken Window Effect ... 503

15.5 ... Code Review and Learning ... 506

15.6 ... Clean Code Advisors ... 509

15.7 ... Learning Techniques ... 510

15.8 ... Continuous Learning in Cross-Functional Teams ... 514

15.9 ... Summary ... 516

... The Authors ... 517

... Index ... 519

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!

In this book, you'll learn about:

a. Key Concepts
Understand the foundation of SAPUI5: JavaScript. Explore key JavaScript ES6 features such as arrow functions, spread syntax, and more. Then walk through different types of SAPUI5 projects, from library projects to freestyle applications.

b. Best Practices
Learn the rules for clean code. Dive into best practices for decoupling modules, structuring functions, declaring variables and literals, using control flow statements and loops, handling errors, performing automated tests, and more.

c. Practical Examples
Put theory into practice. Use detailed code examples for each concept to help you differentiate between clean and messy SAPUI5 code.

Highlights include:

1) JavaScript
2) Modules and classes
3) Functions
4) Naming
5) Variables and literals
6) Control flow
7) Formatting
8) Error handling
9) Comments
10) Static code checks
11) Testing
12) Implementation

Kunden Rezensionen

Zu diesem Artikel ist noch keine Rezension vorhanden.
Helfen sie anderen Besuchern und verfassen Sie selbst eine Rezension.