Hot answers tagged

7

Purists won't call any test a "unit test" which involves a database. Other purists won't call a test an "integration test" when there are not at least two components involved (and a platform like the SQL engine of the DB usually does not count as a component). And some not so puristic people call everything a unit test which gets started by an automatic ...


5

This is not a rounding error, but a wrong application of financial formulas. The formula used for your loan payment is based on financial math designed for a periodic payment with an interest rate for the same period, assuming compound interests. In your usage of this formula, you base yourself on an annual rate r. You calculate the periodic rate ...


5

A warning is just that, a warning that a piece of code is potentially not what you intended. I’m not familiar with this particular PHP warning and this is also not the place for discussion and opinion as you asked for, but sometimes it’s perfectly fine to ignore warnings. And other times not so much. It’s up to the professional assessment of the ...


4

Coding needs to be intentful - this warning is the compiler saying "are you sure you just want to create a default object out of nothing here?". Maybe you thought the variable had been assigned/initiated already, maybe you knew it wasn't and really do want to create a new default object, but without the line $foo = new stdClass(); your intent is unclear. (...


3

There are two distinct questions: One, what's the harm of creating a default object from an empty value? Obviously, no harm at all if that is what you intended. Possibly huge harm if it was not what you intended. Your judgement call. Two: What's the harm in ignoring the warning? If you don't check that the code does what you intended, then ignoring the ...


3

No. You need a declared transaction for a rollback to work. Declaring a transaction is necessary so that the original state of the data can be held somewhere. Otherwise, there is nothing to roll back to. You can easily test this yourself, with and without a transaction, by observing that calling rollback without a transaction has no effect. Further ...


3

I’ve been trying to get a firm understanding of the MVC design pattern Model View Controller is an impossibly simple pattern. As long as you have something that focuses on the model, the view, and the control then poof you're using MVC. The pattern is so old that no one agrees how those things communicate or how they should be separated. Anything beyond the ...


2

Actually, you do have an account system, only a very limited one that supports only a single authenticated account. To prevent non-authenticated access to the admin pages, you should use the same mechanisms as what gets used by a more sophisticated account system for protecting pages that should be accessible only to authenticated users.


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