Refactor Your PHP legacy Code (real projects examples)

It is ok for private methods to have longer names as they have a limited scope.Only use general names with methods that implement interfaces example add() and use descriptive names for single classes methods addUser() or addDocument().Remove unused methods from your classes.Use prefix is/has with functions that return boolean ex: isAdmin($user), hasPermission($user).Always use access modifiers in class methods and properties.Be careful with interface pollution: Only use methods that users can use publicly.Organize classes methods where public methods are on the top.Always apply the single responsibility concept to your classes.Write clean code and get rid of code smells with real life examplesCode smells are a set of common signs which indicate that your code is not good enough and it needs refactoring to…hackernoon.comMore to Read:- Software Architecture — The Difference Between Architecture and Design- Software Architecture: Architect Your Application with AWS- Write clean code and get rid of code smells with real life examples. More details

Leave a Reply