Tag Info

Hot answers tagged

6

Immutable objects in general have several benefits. The most important one is how easy is to use immutable objects in code executed in parallel. This also explains why "immutability has never really caught on in the land of PHP". State consistency is easier to obtain. Objects are easy, more natural to work with. The essential thing is how much the object ...


4

What advantages do people see in using immutable request/response objects? I agree with @MainMa's statement "I'm not sure if the slight benefit of readability compensates the possible lack of flexibility" and personally I don't see any practical and useful aspects of forcing PHP HTTP Request temporary objects or PHP HTTP Response temporary objects to be ...


4

Your example is already flawed, as Admin gains new properties over the base class which makes it incompatible. It would have been smarter to place the $permissions property straight away in the base class. Ask yourself, in what cases could it be desirable to introduce new properties on an existing object? Both instantiating an object as an instance of a ...


3

Storing information related to the exceptional circumstance in the exception is definitely a good thing, as it can allow a handler to fix & retry or fail gracefully. It's not logic but data, so you don't have to worry about the exception class being too complex. If the exception took a route and extracted the supported methods, that would be getting too ...


2

As with any naming question it's hard to say that anything is incorrect, but it would definitely be misleading and/or confusing to use the term "framework" for this. The term "framework" normally refers to something like ASP.NET which provides necessary features like session management, but doesn't impose any particular page hierarchy. Using "skeleton" seems ...


2

Framework has come to mean something like angular.js or .NET, so it would perhaps be misleading to use that word. (Only because of current trends in programming culture, though; it's perfectly reasonable usage otherwise.) You could refer to your initial set of files as a scaffolding, or as mock-ups if they only exist to show an initial visual design.


2

Some people still use it (I'm one of them). So, it hasn't been replaced. In fact, I switched to Perl from PHP.


1

Since you are not developing a website or a web application, but a desktop application which stores its data on a server, there are indeed a few layers you can skip. A common approach, in this situation, is to use web services. When a service should be lightweight and interoperable (that is, you can use it with ease from virtually every programming ...


1

Yes it is. DuckDuckGo is one company that I know of that started with Perl as the server side language. I believe they are still using Perl primarily. https://github.com/duckduckgo


1

If your exception did in fact contain any logic, I would take issue with it, but it does not, so I think it is fine. What it contains is the range (the set, actually) of accepted values, which is not a bad idea. (It might be unnecessary, because the range of accepted values is fixed and known in advance, but not bad at all.) I think that it should also ...


1

Your code is very difficult to read and it appears your data isn't structured well for what it represents and how it's used. I suspect if you address these issues then the solution to your reusability problem will become clear. It isn't completely obvious what your code does, but take this example loosely based on what I think your code is doing: class ...


1

If you add a method Lead.list() where it returns a list of leads it's violation of SRP, as the fetching a list of Leads is not the responsibility of Lead object. So the best option is to use a data service or a repository. For example LeadRepository could have methods GetAll(), GetById(id)


1

What Ixrec said. I would like to add that I would call it a site map, because that's what a sitemap basically is. The site map may have a public part, which you might want to include in an actual "site map page" presented to the visitors, and a private part, which might contain things like administration pages etc. the existence of which you probably ...


1

Black-box testing means that the tester is not familiar with the inner workings of the system, while white-box testing is performed by someone who knows exactly how the program works. Both has advantages and disadvantages. Functional testing is testing whether or not the software product fulfills functional requirements, like "when loading an incorrectly ...


1

Black-box testing as opposed to white-box testing is a broad category of testing that includes tests where you do not know, and do not need to know, how the implementation works, you just want to test the outcome. For example: I click the buy button on a web site and the item I selected is now in my shopping cart. I don't care how the programmer made this ...


1

This is a hotly disputed aspect of software licensing. One interpretation is that, if you are not -distributing- a library, you do not need a license, nor do you need to accept or comply with any terms attached to use of the library (with the caveat that you might still have to accept terms to do any meaningful testing of your program). By this ...


1

Could be (too) heavy for my server performs that check every time? This is just not good practice in general. If you end up working with other developers and they inherit from Controller as well (which seems like a very centric object in your domain) you will end up with a lot of heavy processing on your server. I would suggest only setting things in ...



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