[SkillShare] Clean Code With PHP Examples
About This Class
This is a course about useful clean code principles.
My aim is to teach you concepts that you can use every time you write code.
Clean Code can help you:
– Write better PHP code and thus become a better PHP programmer
– Create easy to maintain projects
– Perform better during interviews by showing knowledge of advanced programming concepts
The course has PHP examples and I sometimes mention things like Symfony and MVC.
The course is structured in 4 parts:
1. Introduction – where we discuss what is clean code and why it’s important
2. Small Functions – I gave small functions an entire section because I think its one of the most important principles of clean code, together with small classes, Single Responsibility Principle and Not crossing Different Levels of Abstraction.
3. Clean code: Fundamental Principles – I discuss here about fundamental things like method and variables names, parameters, comments and exceptions
4. Clean code: Advanced Principles – Here I talk about more abstract topics like the difference between an OOP Object and a Data Structure Object, Composition over Inheritance, Symptoms of Bad Code, State, Low Coupling – High Cohesion, Command and Query Separation, Tell Don’t Ask, The Law of Demeter, YAGNI and more.
The course also contains some memes because you can’t spell clean code without fun.
I tried to focus on things you can use every day when programming and stay away from barren theory.
There’s no point wasting our time with useless knowledge that would just seem like it’s helping you as a programmer, but that you will forget in 2 weeks.
If that would have been the point, this would be a 10 hours course about programming patterns.
But it isn’t.
I tried to make the course full of useful information but not too long.
If you invest as little as two hours of your life in this course, about the time you would spend watching a movie, you will become a much better developer.
Hands-on Class Project
Create a project using clean code practices:
• Use TDD
• Always think if your code is easy to understand
• Write small functions and classes
• Respect SRP
• Don’t cross different levels of abstraction
• Give proper names and use the scope rule
• Less than three parameters
• Don’t use Boolean or null arguments
• Beautify predicates when appropriate
• Stay away from comments and express yourself in code
• Use only custom runtime exceptions
• Treat objects properly keeping in mind if they are OOP Objects or Data Structure objects.
• Use Composition over Inheritance
• Be on the watch for symptoms of bad code
• Treat state carefully
• Keep your coupling low and your cohesion high
• Try to use command and query separation, tell don’t ask and even the law of Demeter
• Don’t use complex patterns and don’t over-engineer
• Web Development
• Clean Code
I’ve been a programmer for thirteen years.
I am a big enthusiast of Clean Code.
I’m also a big fan of SCRUM and how you can build motivated, happy teams around it.
I’ve worked on a lot of kind of projects.
From small to medium projects where I was the only developer to medium and big projects in teams of 30+ people.
Besides being a developer, on some projects I’ve also have the Scrum Master role, or led the process of applying Scrum inside the team.
I am currently writing mostly Java, and have certifications in PHP and Scrum.
Size: 673 MB