Alexander Bandukwala

53%
Flag icon
​  ​const​ content = File.read(file_name); ​  ​const​ lines = find_matching_lines(content, pattern) ​  ​const​ result = truncate_lines(lines) Many people write OO code by chaining together method calls, and might be tempted to write this as something like: ​  ​const​ result = content_of(file_name) ​  .find_matching_lines(pattern) ​  .truncate_lines() What’s the difference between these two pieces of code? Which do you think we prefer?
Alexander Bandukwala
This is great example of the harm of methods
The Pragmatic Programmer: Your Journey to Mastery, 20th Anniversary Edition
Rate this book
Clear rating
Open Preview