Software Engineering

#32 Refactoring | Book Review

Refactoring: Improving the Design of Existing CodeRefactoring: Improving the Design of Existing Code by Martin Fowler
My rating: 4 of 5 stars

Context & Why I read this book
I am a software engineer with a focus on mobile applications and was looking for a more systematic approach to safely rewriting code without causing regressions. Such methodical "refactoring" is a valuable skill for developers; especially in enterprise settings where one works on large codebases with many contributors. Further, Addison Wesley & Martin Fowler are renowned in the field of software construction.

What is the book about as a whole?
The author himself says that this is a guide for professional programmers on how to refactor code "in a controlled and efficient manner". He explains what refactoring is (and what not), how to do it properly and he gives many detailed and step-by-step code refactoring examples using the programming language JavaScript. (This review is about the second edition of the book, which appeared 18 years after the first edition, which used Java for code samples)

The book's structure
The book is divided into 12 chapters:
1. Refactoring, a First Example(the author deliberately leads with a very practical introduction instead of a theoretical one)
2. Principles in Refactoring(a more general and theoretical introduction to the concept of changing software systems without causing regressions)
3. Bad Smells in Code(a list of indications that show you _when_ to apply refactoring; unfortunately no code samples in this section)
4. Building Tests(A dedicated section on automated testing, since refactoring cannot be done without an appropriate test suite)
5. Introducing The Catalog
6. A First Set of Refactorings
7. Encapsulation
8. Moving Features between Objects
9. Organizing Data
10. Simplifying Conditional Expressions
11. Refactoring APIs
12. Dealing with Inheritance

Chapters 6-12 make up the "refactoring catalog", which contains 67 "refactorings" with names like:
- "Change Function Declaration"
- "Extract Function"
- "PullUp Method"
- "Replace Loop with Pipeline"

Each Refactoring contains a small graphic to memorize the refactoring, followed by a short and glanceable code example and a section on the motivation of the particular refactoring. Then there is the main part: a section called "mechanics" which is a detailed list of usually 5-12 steps on how to approach the given Refactoring followed by a detailed example with sample code.

The physical book comes with a free digital web version included.

One lesson
Rather than mentioning a particular refactoring or concrete advice from the book I want to take the lesson with me, that "Refactoring" is no island and only works properly in combination with self-testing code (automated tests), trunk based development (or continuous integration) and the general philosophy of opportunistically improving a code base little by little.

Reading Recommendation / Who should read this?
I think, that this book (in its second edition!) makes a good and valuable contribution by showing you that there is a more methodical and structured way of changing code. The book will not render you a refactoring expert since most of it (the catalog) is meant for reference instead of up-front learning (while containing many code samples, there are no exercise or challenges to solve and Fowler himself refers to William C. Wake'" Refactoring Workbook this regard). But even if it did, according to my limited experience in the field, in many (if not most) enterprise settings with legacy codebases and large teams there is not much hope that introducing this will ever work (see my lesson above). So while at the moment I don't see much practical relevance for myself I still consider it worthwhile to read this book for software engineers. Also, if you think this is wrong and your company successfully applies this, pls hire me.

All in all a 7 out of 10 (⭑⭑⭑⭑) on my personal rating scale ("Good read, despite minor weaknesses; generally recommended.")

-----------

View all my reviews on Goodreads

#27 Xcode Treasures | Book Review

XCode TreasuresXCode Treasures by Chris Adamson
My rating: 3 of 5 stars

Context & Why I read this book
I am a software engineer with focus on Swift and Apple platforms. Using Xcode is my daily bread. I was hoping to learn some more tips and tricks to master my main IDE.

What is the book about as a whole?
The book takes you through all major parts of working with Xcode, the IDE for developing software on Apple platforms. It tackles basics like project setup, working with storyboard, and editing source code but also explores some more intermediate topics like improving performance, security, and extending Xcode.

The book's structure
The book is divided into 12 chapters and comes with many screenshots and code samples:
1. Projects
2. Storyboards: Appearance
3. Storyboards: Behavior
4. Editing Source Code
5. Building Projects
6. Debugging Code
7. Improving Performance
8. Automated Testing
9. Security
10. Source Control Management
11. Platform Specifics
12. Extending Xcode

One lesson
One thing I learned about was were the advanced breakpoint actions Xcode offers: logging messages, playing sounds, executing debugger commands, and the "expr" LLDB command which lets you change the values of variables at run-time, something that can come in handy once in a while.

Reading Recommendation / Who should read this?
(This recommendation is only targeted at developers on Apple platforms) I don't think that you necessarily need to read it (especially if you have 3+ years of experience with Xcode). I learned a couple of new things but in the end, the book was lacking depth. Also, quite naturally for a book like this, newer topics are missing (like working with SwiftUI previews or using the latest Xcode features from the last 2-3 years). Considering that there are so many valuable other books you can read to improve your craft overall this is a 5 out of 10 (⭑⭑⭑) for me.

----------

View all my reviews on Goodreads

#18 Objective C - Kurz & Gut | Book Review

Objective C Kurz & GutObjective C Kurz & Gut by Lars Schulten
My rating: 3 of 5 stars

Context & Why I read this book
For my new job, I had to prepare myself and refresh my knowledge of Objective-C. This seemed to be a good and quick overview.

What is the book about as a whole?
The title pretty much sums it up. It's a short introduction to the programming language Objective-C, which is a superset of C, extending it by OO concepts.

The book's structure
The book comes in handy pocket format, is comprised of 15 main chapters of different lengths and contains some language reference chapters and an index at the end.
1. Basics
2. Syntax
3. Objects
4. Classes
5. Categories
6. Protocols
7. Errors and Exceptions
8. NSObject
9. Object Life Cycle
10. Memory Management
11. Runtime information
12. Messaging
13. Key/Value-Coding
14. Object Archiving
15. Blocks
16. NSObject Reference
17. Compiler Directive Reference
18. Alternative Platforms
19. Clang Operation Reference

One lesson
Obviously, in reading this, I learned and refreshed some of my knowledge about the language syntax and peculiarities. Especially interesting however was some of the side information given, e.g. the relationship to the C language, concepts like Monkey Patching, and some best practices.

Reading Recommendation / Who should read this?
The book itself is okay; it mostly does what it's supposed to. Due to the fact that Objective-C is a kind of "obsolete" language, I would not recommend reading this, unless you'll join some heavy legacy project soon. Overall this is a 6 out of 10 (⭑⭑⭑) for me ("OK; the average read. Tangible weaknesses, but recommended with some reservations").

-----------
View all my reviews on Goodreads

#4 PracticalCombine | Book Review

Practical CombinePractical Combine by Donny Wals
My rating: 3 of 5 stars

Context & Why I read this book
This is the fourth book I finished in 2021. My motivation was to get my hands dirty with Combine, Apple's new Functional Reactive Programming framework.

What the book is about
The book is about getting to know Combine and is comprised of 13 chapters:
Chapter 1 - Introducing Functional Reactive Programming
Chapter 2 - Exploring publishers and subscribers
Chapter 3 - Transforming publishers
Chapter 4 - Updating the User Interface
Chapter 5 - Using Combine to respond to user input
Chapter 6 - Using Combine for networking
Chapter 7 - Wrapping existing asynchronous processes with Futures in Combine
Chapter 8 - Understanding Combine’s Schedulers
Chapter 9 - Building your own Publishers, Subscribers, and Subscriptions
Chapter 10 - Debugging your Combine code
Chapter 11 - Testing code that uses Combine
Chapter 12 - Driving publishers and flows with subjects
Chapter 13 - Where to go from here

Additionally, some source code and example projects are provided.

One lesson I am taking from it
I especially liked the sections on backpressure management (controlling flow by signaling a subscriber’s readiness to receive elements) which, in my opinion, was explained better than in other resources on the topic I know of. After this book, I am confident that I understood this concept better.

Reading Recommendation / Who should read this?
I recommend this as a cheap, quick & dirty introduction to the subject. It is no theoretical deep dive but supposed to be a hands-on practical book. Still, in my opinion, it did not live up to its name. It was actually more theoretical than I had hoped for.

View all my reviews on Goodreads