Skip to main content
6 votes

How is $this provided in PHP?

As far as I can tell (in the current development version of Zend PHP, at least) it is stored on the call frame¹: struct _zend_execute_data { const zend_op *opline; /* executed ...
Jasmijn's user avatar
  • 1,859
5 votes

Should I split backend into legacy and modern app to make the rewrite feasible?

What would the situation be if you did nothing - that is, neither split the codebase nor rewrote the whole, and just worked within the legacy framework? It sounds like you don't have the resources for ...
Steve's user avatar
  • 10.4k
4 votes

Our php codes base has 6 different ways to do INSERT … ON DUPLICATE KEY UPDATE, how do I fix it?

There are at least two questions in your question: how do I fix the codebase? (ok, this is obvious: you pick a prefered method, then use your a text editor/IDE for refactoring the code and test the ...
Doc Brown's user avatar
  • 212k
4 votes
Accepted

DTOs and Single-responsibility principle

The Single Responsibility Principle does not tell to do only one thing. It says there should be only one reason to change. In your case, the reason to change is the structure of the data to transfer, ...
Christophe's user avatar
  • 79.9k
3 votes
Accepted

Unit testing for non-stateless units - how?

Testing is more than unit testing. Testing can be as simple as running the code and playing with the app. It can be as intense as a suite of tests ran before you're allowed to merge code into a ...
candied_orange's user avatar
2 votes

Mock an API for development purpose (no testing)

You have several connected questions. Have are some short answers. Ignore the fact that googling mocks mostly gets you pages about testing. Why? Because ‘what is it commonly used for’ does not answer ...
Chris F Carroll's user avatar
2 votes

Unit testing for non-stateless units - how?

You have two choices. First let’s assume that the code you are testing is not accessing the database directly, but there is some class in between. And let’s assume there is one place in your code that ...
gnasher729's user avatar
  • 46.8k
2 votes

Should I split backend into legacy and modern app to make the rewrite feasible?

In my experience, replacing an old system by a new one incrementally in parts (which are brought into production), whilst keeping a common database, is a lot less riskier than trying to rewrite a ...
Doc Brown's user avatar
  • 212k
2 votes
Accepted

Interface + Trait vs Abstract Class

I think the easiest way to approach this is by splitting the process of making these design decisions into separate steps, first thinking about the "interface", then about the implementation:...
Doc Brown's user avatar
  • 212k
2 votes

Interface + Trait vs Abstract Class

I am going to answer generically rather giving specifics for a particular language. Three concepts worth considering are: A contract - which states that a particular class supports a set of logically ...
DavidT's user avatar
  • 3,629
1 vote

How to share transaction across multiple repositories in DDD?

How do we solve this problem? You're going to have to relax some of the constraints that are getting in your way. When a product is created/changed, we have to add a TimeLineItem to the Timeline ...
VoiceOfUnreason's user avatar
1 vote
Accepted

Best practices for organising PHP files?

The standard is one file per class or class-like (i.e. class, interface, trait or enum) Following this standard fits with use of PSR-4 autoloading standard and the near ubiquitous Composer autoloader. ...
bdsl's user avatar
  • 3,884

Only top scored, non community-wiki answers of a minimum length are eligible