Tag Info

New answers tagged

0

Practical URL length limit is around 2000 characters - think about whether you could optimize you filters to fit into it. It this is not possible I'd probably implement this as a POST request. Disadvantages: although this is in line with HTTP semantics of POST request (POST can be used for almost anything), it's not a best fit - it's effectively ...


1

If you want to preserve data across the pages, there are several approaches: The URI or the form. A wrong choice in most situations (some ASP.NET developers would disagree, pointing to view state as an example of preserving information in a form). Sessions. This works well for most cases if the size of the preserved data is not very large. Database ...


5

So if a thousand people are following Sally, we insert a thousand rows into the corresponding table. Is that scalable? Yes, provided the database tables are properly indexed. What happens if we get to the point where tens or hundreds of thousands of users are following Sally and she's making a few dozen posts per day? You'll generate a few dozen ...


-2

Answer is always Use normal queries instead of ORM to get better performance. If your are planning to change the database after some longer period ORM helps to done easily.You need to sacrifice performance for convenience. I suggest you to create the separate class where you can perform DML operations by getting the inputs as parameter and create the query ...


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


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.


0

PHP, in my opinion, is a much faster and better choice for the web. We also have Javascript, which is blazing fast due to it's event-based nature. However Perl is still used and there are web frameworks for Perl in web use such as Catalyst. There is also an emergence of Python being used in the web. Frameworks such as Django, which I have had personal ...


-1

No,this is not race condition. Race condition means more than one user updating the value of same variable, and last assigned value will become the value for that variable. For example, if A assign value to variable X = 10, then B assign value to variable X = 12, then C assign value to variable X = 8, then 8 would became value for variable ...


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 ...


0

Using an exception to be part of program-flow is an anti-pattern, they should not be used for things that you expect to happen - hence the name! I'd say that practicality trumps such rules however, but here I'd question why you are throwing such an exception and simply not returning the 405 result code - if the method succeeded you wouldn't throw an ...


-1

As a 20+ years programmer i am surprised HTML/php programming is so weak in how a user can use inspect element to change a value e.g product id before submitting. My solution is to use java script variables and only use HTML such as textboxes to inform the user of my intentions. eg declare variables in a global space i.e outside of a function. Example ...


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 ...


0

But categories can be dynamically created at runtime, and this seems like a lot of code. Is there a convenient solution for this? Only one instance of each object and can handle them dynamically. Or maybe it's not DI at all? Well, if categories can be dynamically created, how are you going to identify and get from DI container? I think you should ...


-2

Well, for such a "complex" project, i suggest that you split up your domains into smaller pieces, call it modules. Maybe it is easier to work with apis/resources instead of direct queries to the database. Let me explain this a bit. Let's assume you want a front end part and a backend part. The front-end and the backend talks over an API, in my case a REST ...


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 ...


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 ...


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 ...


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)


0

You are way too much worrying about performance without actually having measured it. Let your Number class just be a facade, and delegate each computational function to a internal helper class on its own, like a SquareRootCalculator, a SinCalculator, and so on. If you are really going to implement that calculations right from the ground, each of it is ...


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.


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 ...


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 ...


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 ...



Top 50 recent answers are included