• Complain

Christian Clausen - Five Lines of Code: How and when to refactor

Here you can read online Christian Clausen - Five Lines of Code: How and when to refactor full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2021, publisher: Manning, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Christian Clausen Five Lines of Code: How and when to refactor
  • Book:
    Five Lines of Code: How and when to refactor
  • Author:
  • Publisher:
    Manning
  • Genre:
  • Year:
    2021
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Five Lines of Code: How and when to refactor: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Five Lines of Code: How and when to refactor" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Five Lines of Code teaches refactoring thats focused on concrete rules and getting any method down to five lines or less! Theres no jargon or tricky automated-testing skills required, just easy guidelines and patterns illustrated by detailed code samples.In Five Lines of Code you will learn: The signs of bad code Improving code safely, even when you dont understand it Balancing optimization and code generality Proper compiler practices The Extract method, Introducing Strategy pattern, and many other refactoring patterns Writing stable code that enables change-by-addition Writing code that needs no comments Real-world practices for great refactoring Improving existing coderefactoringis one of the most common tasks youll face as a programmer. Five Lines of Code teaches you clear and actionable refactoring rules that you can apply without relying on intuitive judgements such as code smells. Following the authors expert perspectivethat refactoring and code smells can be learned by following a concrete set of principlesyoull learn when to refactor your code, what patterns to apply to what problem, and the code characteristics that indicate its time for a rework. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the technology Every codebase includes mistakes and inefficiencies that you need to find and fix. Refactor the right way, and your code becomes elegant, easy to read, and easy to maintain. In this book, youll learn a unique approach to refactoring that implements any method in five lines or fewer. Youll also discover a secret most senior devs know: sometimes its quicker to hammer out code and fix it later! About the bookFive Lines of Code is a fresh look at refactoring for developers of all skill levels. In it, youll master author Christian Clausens innovative approach, learning concrete rules to get any method down to five linesor less! Youll learn when to refactor, specific refactoring patterns that apply to most common problems, and characteristics of code that should be deleted altogether. Whats inside The signs of bad code Improving code safely, even when you dont understand it Balancing optimization and code generality Proper compiler practicesAbout the reader For developers of all skill levels. Examples use easy-to-read Typescript, in the same style as Java and C#. About the authorChristian Clausen works as a Technical Agile Coach, teaching teams how to refactor code. Table of Contents 1 Refactoring refactoring 2 Looking under the hood of refactoring PART 1 LEARN BY REFACTORING A COMPUTER GAME 3 Shatter long function 4 Make type codes work 5 Fuse similar code together 6 Defend the data PART 2 TAKING WHAT YOU HAVE LEARNED INTO THE REAL WORLD 7 Collaborate with the compiler 8 Stay away from comments 9 Love deleting code 10 Never be afraid to add code 11 Follow the structure in the code 12 Avoid optimizations and generality 13 Make bad code look bad 14 Wrapping up

Christian Clausen: author's other books


Who wrote Five Lines of Code: How and when to refactor? Find out the surname, the name of the author of the book and a list of all author's works by series.

Five Lines of Code: How and when to refactor — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Five Lines of Code: How and when to refactor" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
inside front cover
Quick overview of refactoring patterns
  • EXTRACT METHOD (P3.2.1)Takes part of one method and extracts it into its own method.

  • REPLACE TYPE CODE WITH CLASSES (P4.1.3)Transforms an enum into an interface, and the enums values become classes.

  • PUSH CODE INTO CLASSES (P4.1.5)Is a natural continuation of REPLACE TYPE CODE WITH CLASSES (P4.1.3), as it moves functionality into classes.

  • INLINE METHOD (P4.1.7)Removes methods that no longer add readability to our program.

  • SPECIALIZE METHOD (P4.2.2)Removes unnecessary and problematic generality from methods.

  • TRY DELETE THEN COMPILE (P4.5.1)Removes unused methods from interfaces and classes when we know their entire scope.

  • UNIFY SIMILAR CLASSES (P5.1.1)Unifies two or more classes that differ from each other in a set of constant methods.

  • COMBINE ifS (P5.2.1)Reduces duplication by joining consecutive ifs that have identical bodies.

  • INTRODUCE STRATEGY PATTERN (P5.4.2)Replaces variance through if by instead instantiating classes.

  • EXTRACT INTERFACE FROM IMPLEMENTATION (P5.4.4)Replaces dependencies on a class with an interface.

  • ELIMINATE GETTER OR SETTER (P6.1.3)Eliminates getters and setters by moving the functionality closer to the data.

  • ENCAPSULATE DATA (P6.2.3)Localizes invariants related to variables and makes cohesion clearer.

  • ENFORCE SEQUENCE (P6.4.1)Makes the compiler guarantee things happen in a specific order.

Five Lines of Code How and when to refactor - image 1

Five Lines of Code

How and when to refactor

Christian Clausen

Foreword by Robert C. Martin

To comment go to liveBook

Five Lines of Code How and when to refactor - image 2

Manning

Shelter Island

For more information on this and other Manning titles go to

www.manning.com

Copyright

For online information and ordering of these and other Manning books, please visit www.manning.com. The publisher offers discounts on these books when ordered in quantity.

For more information, please contact

Special Sales Department

Manning Publications Co.

20 Baldwin Road

PO Box 761

Shelter Island, NY 11964

Email: orders@manning.com

2021 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.

Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.

Five Lines of Code How and when to refactor - image 3

Manning Publications Co.

20 Baldwin Road Technical

PO Box 761

Shelter Island, NY 11964

Development editor:

Helen Stergius

Technical development editor:

Mark Elston

Review editor:

Mihaela Batini

Production editor:

Keri Hales

Copy editor:

Tiffany Taylor

Proofreader:

Katie Tennant

Technical proofreader:

Jean Franois Morin

Typesetter:

Dennis Dalinnik

Cover designer:

Marija Tudor

ISBN: 9781617298318

dedication

To my university mentors, who told me

The key to being consistently brilliant is hard work every day.

Olivier Danvy

and

Youre missing the point.

Mayer Goldberg

Thank you for teaching me to stop trying to do the right thing, and do the right thing.

front matter
foreword

Have you ever read a book on software and thought that the author was talking over your head? Did the book use unfamiliar vocabulary and overly complex concepts to make its points? Did it make you feel as though it was written for some elite inner circle of know-it-alls that didnt include you?

This is not that book. This book is down to earth, focused, and right on point.

Neither is this book a primer. It doesnt start at the atom and bore you with the basics of programming and languages. It doesnt try to coddle you and keep you safe. I guarantee that this book will challenge you. But it will challenge you without intimidating you and without insulting your intelligence.

Refactoring is the discipline of transforming bad code into good code without breaking it. When we consider that our entire civilization now depends on software for its further existence, it seems unlikely that there is a topic more worthy of study.

Perhaps you think thats hyperbolic. Its not. Look around you. How many processors running software are currently on your body? Your watch, your phone, your car keys, your headphones... how many are within 30 meters of you? Your microwave, your stove, your dishwasher, your thermostat, your clothes washer... and how about your car?

These days, nothing happens in our society without software. You cant buy or sell anything, or drive or fly anywhere, or cook a hot dog, or watch TV, or call someone on the phone without software.

And how much of that software is actually good code? Think of the systems you are working on right now. Are they clean? Or are they, like most, a mess in desperate need of refactoring?

This book does not present the kind of sterile and simplistic refactoring you may have heard or read about before. This book talks about real refactoring. Refactoring in real projects. Refactoring in legacy systems. Refactoring in the kinds of environments that we all face virtually every day.

Whats more, this book wont make you feel guilty for not having automated tests. The author realizes that most inherited systems grew and evolved over time, and we are not so fortunate as to have such test suites.

This book lays down a set of simple rules that you can follow to reliably refactor complex, messy, tangled, untested systems. By learning and following these rules, you can make a real difference in the quality of the systems you maintain.

Dont get me wrongits not a silver bullet. Refactoring old, crufty, untested code is never easy. But armed with the rules and examples in this book, you will be able to make inroads against the cruft and tangle of systems that have bedeviled you for too long.

So I advise you to read this book carefully. Study the examples. Think hard about the abstractions and intentions the author presents. Get the codebase he offers, and refactor it along with him. Follow his refactoring journey from beginning to end.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Five Lines of Code: How and when to refactor»

Look at similar books to Five Lines of Code: How and when to refactor. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Five Lines of Code: How and when to refactor»

Discussion, reviews of the book Five Lines of Code: How and when to refactor and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.