Can removing unnecessary file from a repo be considered part of refactoring?

We’re using Git as our DVCS and we’re about to start to do a clean up (never done before in this team) of files that are not necessary (not part of the sources) from our products.

This is done in two ways:

  • removing the product files from the repo and adding them to the ignore list.
  • deleting dead code

According to Wikipedia:

Code refactoring is the process of restructuring existing computer code without changing its external behavior. Refactoring improves nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity to improve source code maintainability, and create a more expressive internal architecture or object model to improve extensibility.

and from Martin Fowler’s entry:

Refactoring is a very specific technique, founded on using small behavior-preserving transformations (themselves called refactorings).

I haven’t read anywhere that removing dead code or removing files from your repo are considered refactoring techniques but I see them both as techniques that “improve source code maintainability” by removing irrelevant code that may distract us later on.

Do you think it’s reasonable to call those two activities “Refactoring”?

3

I had to stop and think for a minute. This is not refactoring all on its own, but it’s completing someone’s refactoring or feature which was never finished.

Think about how the inert resources and dead code works its way into the codebase.

  1. It was added, but never used. Someone began a refactoring or started a feature but never completed that task.

  2. It was a tagalong with other useful code. Someone needed 1 function, but they added a whole directory of code/resources just to get that 1 function.

  3. New logic caused the resources/code to be abandoned. A re-skin was done, but the old resources were never removed. A refactoring caused unused classes/functions, but that code was never removed.

In all of these cases, if the work was properly completed, the cleanup would have been done as a part of that task.

Now you need to go back and finish those old tasks. It’s not refactoring. It’s completing old work.

Nope, I wouldn’t consider it refactoring – you’re not actually changing anything by removing unused code files from a project, its more a cleanup task. As you say these are not part of the sources.

However, removing unused code from a file where some code remains can be considered a refactoring because you are changing the codebase, or removing code files from an active project where they used to be compiled in is a refactor – your codebase has changed, even if very slightly. You never know what crazy side-effects this change might have, whether its due to the executable size, include chains, or even simple reflection into the application that used to work and no longer does after you remove the code. As a result, you should be keeping track of the change as if it was a real code change, just so you can return to it later and pinpoint what changes were made to your old, working application.

So if you have truly useless files in your repo that are truly not used (and I think of things like .obj files or other non-code files) then get rid of them before you migrate.
If, however, they are code files, add them in and then delete them from the project and your repo so they remain in history only.

I think removing dead code would technically be classified as refactoring, because it’s a code transformation that does not change the overall code’s functional behavior.

Adding files to an ignore list seems more like a code metadata transformation than an actual code transformation, so I’m not sure whether it would technically be considered refactoring.

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