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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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:...
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 ...
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 ...
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. ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
php × 2055object-oriented × 261
mysql × 198
design-patterns × 189
web-development × 139
mvc × 139
javascript × 107
design × 97
database × 77
laravel × 71
web-applications × 68
architecture × 56
java × 50
frameworks × 49
object-oriented-design × 48
security × 47
unit-testing × 46
api × 46
html × 45
programming-practices × 41
dependency-injection × 41
python × 37
ajax × 37
rest × 35
sql × 35