Read refactoring: improving the design of existing code

Source: Internet
Author: User

I first read this book because of a friend's introduction and stepping on the University's tail. At that time, I really didn't know what I was thinking. My mind was simple and I had nothing to do. At that time, I was so confused that I had finished my graduation reply, students go home or work one after another, every time! Whether it's junior high school, high school, or university, I seem to get used to watching my colleagues get along in year 34. This is so uncomfortable. Because I plan to go north, so ~, You must prepare your chips. I have read several books. The book I want to talk about is one of them. However, this book was half done before graduation, with less than two hundred pages, but many of them mentioned the problems I ignored in daily coding. It may also be caused by poor programming habits. After work, I don't want to go back to the code I wrote. I think about it and I want to optimize it. I want to refactor it and then I bought this book to continue reading it, then, because the city is far away from the company, it may take more than an hour for the subway to visit the site every day or come back at night, so I haven't written a blog for more than ten days, then catch up with the great motherland Mother's birthday, and there will be a seven-day long holiday. Think about writing something down.

Back to the question! What is refactoring? The point of this book is to modify the code without changing the external behavior of the Code to improve the internal structure of the program.

Currently, if I have a very bad project (which means that the project can run with complete functions, but the code structure is very messy and the design is poor), I start to refactor it and the reconstruction steps are very simple, it seems a little too simple. I just need to move a field from one class to another class and pull some code from one function to another function, or you can simply push some code down in the inheritance system. However, the accumulation of these small changes can fundamentally improve the design quality.

This book is probably a Standard Guide for refactoring. Its content is quite unique. We will give examples step by step from the beginning of the example. It is vivid and has many reconstruction principles. I will not describe these principles one by one, these principles are also some of the experiences of programmers. If you are interested, you can study them.

Let me talk about what I learned when I read this book. If I program more than three rows of statements, I make it into a function and call it. If a function has too many rows, I will break it down, wait, it's just a glimpse. This book also has many ideas used in other source code. I did not recite those principles, nor remember where to use them, this will be used for refactoring. Of course, I am also like playing a game with a level 30 level. I am a little bit confused about restructuring as a thought of my code. No, it should be a habit, the one that comes with confidence. Sharing!

This article from the "integration of knowledge and practice" blog, please be sure to keep this source http://poarry.blog.51cto.com/5970996/1560407

Read refactoring: improving the design of existing code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.