All Projects → adamculp → Refactoring101

adamculp / Refactoring101

Licence: bsd-3-clause
The code here, represented as steps, is the progression of a refactoring on a legacy codebase. It is a PHP equivalent of the Java code shown in the Martin Fowler book "Refactoring".

Projects that are alternatives of or similar to Refactoring101

Scientist.js
🔬 A JavaScript interpretation of the Ruby library Scientist, a library for carefully refactoring critical paths.
Stars: ✭ 600 (+581.82%)
Mutual labels:  refactoring
Comby
A tool for structural code search and replace that supports ~every language.
Stars: ✭ 912 (+936.36%)
Mutual labels:  refactoring
Dicas De Programacao Em Ruby
Dicas para iniciantes de boas práticas de desenvolvimento de software em Ruby
Stars: ✭ 59 (-32.95%)
Mutual labels:  refactoring
Scientist
🔬 A Ruby library for carefully refactoring critical paths.
Stars: ✭ 6,301 (+7060.23%)
Mutual labels:  refactoring
Lispy
Short and sweet LISP editing
Stars: ✭ 856 (+872.73%)
Mutual labels:  refactoring
Refactoring Aware Diff
RAID is a tool pipeline that seamlessly enriches GitHub diff results with refactoring information.
Stars: ✭ 50 (-43.18%)
Mutual labels:  refactoring
Phpactor
PHP completion, refactoring, introspection tool and language server.
Stars: ✭ 591 (+571.59%)
Mutual labels:  refactoring
Personal Goals
List of books I've read, projects I've done, videos I've seen, articles I've read or podcasts I've listened to.
Stars: ✭ 75 (-14.77%)
Mutual labels:  refactoring
Honeyjs
An open source Javascript Honey Pot implementation
Stars: ✭ 20 (-77.27%)
Mutual labels:  refactoring
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-34.09%)
Mutual labels:  refactoring
Wild Workouts Go Ddd Example
Complete application to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring of a Go project.
Stars: ✭ 756 (+759.09%)
Mutual labels:  refactoring
Programming Book Recommendations List
My personal list of books that I recommend to read if you are a software developer
Stars: ✭ 22 (-75%)
Mutual labels:  refactoring
Experiment
A Go package for experimenting with and evaluating new code paths.
Stars: ✭ 51 (-42.05%)
Mutual labels:  refactoring
Pre Commit
A framework for managing and maintaining multi-language pre-commit hooks.
Stars: ✭ 7,024 (+7881.82%)
Mutual labels:  refactoring
Scientist
A kotlin library for refactoring code. Port of GitHub's scientist.
Stars: ✭ 60 (-31.82%)
Mutual labels:  refactoring
Scalafix
Refactoring and linting tool for Scala
Stars: ✭ 597 (+578.41%)
Mutual labels:  refactoring
Clink
A developer assistance tool to help with refactoring and keeping related code up to date with changes
Stars: ✭ 40 (-54.55%)
Mutual labels:  refactoring
Vscode Glean
The extension provides refactoring tools for your React codebase
Stars: ✭ 1,194 (+1256.82%)
Mutual labels:  refactoring
Laboratory
Achieving confident refactoring through experimentation with Python 2.7 & 3.3+
Stars: ✭ 1,179 (+1239.77%)
Mutual labels:  refactoring
Refactoring2 Zh
《重构 改善既有代码的设计第二版》中文翻译
Stars: ✭ 54 (-38.64%)
Mutual labels:  refactoring

refactoring101

The code here, represented as steps, is the progression of multiple refactorings on a legacy codebase. The files were created to go along with a "Refactoring 101" talk (slides found at http://www.slideshare.net/adamculp/refactoring-23666462), as a PHP version of the Java code shown in Martin Fowler's book "Refactoring". http://www.refactoring.com/

The code is based on the PHP 5+ object model, so older versions of PHP will not work.

NOTE: While this series of files/steps highlights common refactorings, it is not representative of "great code" or a finished product. But is in fact a "work in progress". By that I mean there is still more refactoring/work to be done which is beyond the scope of this project. These files are meant for training only, and not meant to be a completed project.

Also note the whitespace is not how I would normally handle it. However, since this code will be used in presentation slides for a talk I have handled whitespace differntly so code blocks are compact, thus enabling code to be shown larger on the slides.

Files/Steps

  • 001-begin.php
  • 002-extract_method.php
  • 003-rename_variables.php
  • 004-rename_method.php
  • 005-move_method.php
  • 006-replace_temp_with_query.php
  • 007-extract_method.php
  • 008-replace_temp_with_query.php
  • 009-replace_temp_with_query.php
  • 010-multiple_statement_types.php
  • 011-move_method.php
  • 012-move_method.php
  • 013-replace_type_code_with_state.php
  • 014-move_method.php
  • 015-repl_conditional_w_polymorphism.php
  • 016-repl_conditional_w_polymorphism.php

How to use these files:

These files are best used by doing a diff-like side-by-side view of the previous and next versions. I have included a doc block in the head of each file to explains the changes, and in some cases why they were done. (Which also coincides with the book mentioned earlier.) However, it is best to look at the code itself to see what was done with each iteration.

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].