Should a new class refactored out of an existing one have history pointing back to it’s progenitor

If I split one class into two classes should both classes have history in source control tracing back to the original class that contained both; or should the new class be added as a new file without any history tracing back?

When splitting a large class into two similar sized parts this seems like the natural approach since the older versions of the combined class will have large amounts of relevant history for both descendents. When I’m just pulling one or two methods out to create a helper class, having the complete history for the new class be >90% changes in the parent that affected code that wasn’t split out seems like a recipe for confusion in the future.

6

It’s much easier to ignore some history later than to try to splice it back in. In general you want to favor the least destructive option. People primarily review source control history for three reasons:

  1. To find out which change introduced a bug.
  2. To discern the reasons why a section of code is in there.
  3. To find out what has changed since the last release or the last time you updated.

Copying history for a split file contributes little if any confusion for any of those use cases. The worst that happens is you have to sift through some irrelevant commits, and you generally have to do that anyway. On the other hand, not having the history past a certain point makes the first two use cases much more difficult.

I’m not sure this type of thing is necessary.

Your initial check in of the new class might say “Split ClassX and created ClassY and ClassZ based on it because…..”

If a user really needs to trace back they can still find the original history.

5

That’s what code repositories are for (Git, Subversion, et.al.).

Having maintained some very, very old code I can say that one of the worst things you can do is leave “history” in code files.

Ancient, esoteric code fragments and cruft is not documentation.

A functioning, in production code base is not a museum.

Every line of code costs time and money to maintain, every line; including non-functioning, irrelevant, obsolete ones.

Each successive code change makes all earlier ones less relevant, less informative, and harder to understand.

How can I explain it… I want to take flying lessons, but wait! What’s this about the Wright Brothers? Oh, I need to stop and learn all about how the Wright Flyer worked and after too much time wasted realize that explicit details about how that thing worked are totally irrelevant to using this airplane. And what in the wide world of sports is this old rusted dohickey in the instrument panel?

In the final analysis Anything I need to know is incorporated in the current design.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật