Welcome Guest, Not a member yet? Register   Sign In
best practices of solid programming
#1

(This post was last modified: 08-09-2020, 09:55 PM by jreklund.)

I have a large scale project on ci3 and i want migration to ci4 . We developed a lot of library and try to stand on SOLID principles.

Ci3 is very simple , Libraries on ci3 just like pure PHP programming. we dont use hmvc pattern , just make libraries and used theme.
Where i find example about my custom library , modularization , middlewares , custom middleware and etc on Codeigniter 4?
Reply
#2

Hey guys, is anybody here ?!
Reply
#3

@Hoodini,

Have you looked at the online documentation to see if it can answer any of your questions (https://codeigniter.com/user_guide/insta...ading.html)?
Reply
#4

Here are some best practices to follow when using the SOLID principles in your code:

Start small: Start by implementing the SOLID principles in small parts of your code, and gradually expand as you get more familiar with the principles.

Keep classes small: A class should only have a single responsibility, and it should be easy to understand what that responsibility is. If a class is becoming too complex, consider splitting it into multiple smaller classes.

Avoid tight coupling: Minimize the dependencies between classes, and aim to make the relationships between classes as loose as possible. This will make it easier to modify and extend your code in the future.

Use dependency injection: Dependency injection allows you to create loosely-coupled relationships between classes. This makes it easier to test your code and to extend it in the future.

Write unit tests: Unit tests are an important tool for ensuring that your code works as expected and for making sure that changes to your code do not break existing functionality.

Refactor regularly: Regularly refactoring your code helps to keep it clean and maintainable. Make small changes frequently, rather than trying to make big changes all at once.

By following these best practices, you can write code that is more maintainable, testable, and scalable.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB