Tag: php

  1. SOLID - Dependency Inversion Principle

    In this post, we are going to talk about the D from SOLID, which is Dependency Inversion Principle. What is Dependency Inversion Principle. Normally when we create classes for our software, we will start from the lowest level first. For example if I need to create a Dog class, I…

    on solid oop php

  2. Some ways to remove IF statement in your PHP code

    In this post we are going to talk about how can we reduce the usage of IF statement in our code. Why do you want to remove IF statement? IF statement is all good for us to control the flow of your logic. But sometimes when your logic getting too…

    on php oop

  3. Composition over Inheritance

    In this post, we are going to talk about Composition over Inheritance. What is Composition over Inheritance? In order to understand the topic we need to understand Composition and Inheritance separately. For programming, it all boils down to trying our best to avoid duplication, trying our best to make sure…

    on oop php programming solid

  4. Command/Query Segregation in PHP

    This is gonna be a short post regarding the command query segregation in object oriented programming. What is Command/Query Segregation? It means that a method is either a command performing an action, or a query that returns data, but not both. Being purely action-performing methods, commands always have a…

    on php object oriented programming oop cqrs refactor cleanc code

  5. Write Better OOP Code in PHP

    I happened to read one post that I found to be so useful to me and I want to share some opinions of the article. You can find the link here. It is about how to write a maintainable code in an object oriented way that can embrace changes. Why…

    on php object oriented programming oop design pattern refactor

  6. Refactoring Conditional Expressions

    In this post we are going to talk about how to refactor your Conditional Expressions in PHP. What is Conditional Expressions? Just like the above diagram that Conditional Expressions performs different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. <?php $a = 1;…

    on php object oriented programming oop design pattern refactor

  7. Using Polymorphism to deal with switch in PHP

    In this post, we are going to talk about how to deal with switch situation using object oriented way I mean Polymorphism. What is Switch? As most of programmers familiar with how to using switch statement to handle different situations. Let's have a look at the following code using switch.…

    on php object oriented programming oop

  8. PHP Design Patterns - Singleton Pattern

    This is one of the posts from PHP Design Patterns series. In this post we are going to talk about Singleton Pattern for PHP. What is Singleton Pattern? According to Wikipedia that In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to…

    on php design pattern object oriented programming