New answers tagged

1

Curious if some other term besides "set," which could also be a group of things, has been used regularly in the industry that won't make the API seem utterly strange. What is the problem with set? Good naming is hard: Don't get clever Be consistent Names should be simple and descriptive, this is hard to do. setSomething() is about as simple and ...


1

You could use a wither method, instead of a setter. This has different semantics, suitable for use in an immutable object and with functional programming: class Something { private $value = ""; // getter public function value(): string { return $this->value; } // wither - immutable object solution public function ...


0

Since you are using Laravel it could be useful to use some of the helper functions that the framework gives you: use Illuminate\Support\Str; use Illuminate\Support\Facades\Storage; class Rules { public function getTableRules() { return $this->getRules('Table'); } public function getTextRules() { return $this->...


3

This sounds like premature optimization. It is actually built into the network stack that connections queue up until the server is ready to process so no need to reinvent the wheel. Just inserting one row into mysql is very fast. There is no difference with regards to the time it takes to insert one row to mysql or pushing to a persistent queue. If you ...


2

For almost any major programming language, there are existing queue components which can help you to implement an asynchronous execution of arbitrary tasks, which is what you described in your question. Better don't reinvent the wheel. For example, for PHP, this older stackoverflow Q&A gives you several alternatives. You will find more options by ...


0

You should be testing at multiple levels. At the lowest level are unit tests that exercise a single unit of code in isolation (that could be a single Handler). The advantage of unit tests is that they are typically automated and should be designed to be fast so that they can be executed very often without interrupting you, the developer, in your workflow. ...


-2

I think you should go for disable right click on your web page <script type="text/javascript"> $(document).ready(function () { //Disable cut copy paste $('body').bind('cut copy paste', function (e) { e.preventDefault(); }); //Disable mouse right click $("body").on("contextmenu",function(e){ return false; }); });


1

Well the question to this answer is simple and is not relativ to the MVC at all: All views or controllers share some logic. So they inherit something from a master view or controller class. And then extend it with their specific stuff. Everything can be done with solely one class and just work with flexible methods. The question is, when does it make sense ...


1

I will try to answer some of these questions. Having a single View Class helps makes the code easier to maintain if they share a lot of components. For most of the pages, it's common to always have the same header and footer. This is only different in pages that require authentication. For example, a login page will have its own header and footer. In this ...


0

My point of view is, if you see a notice... you should without a doubt and without hesitation; fix it. Not only does an entire error/notice free app make you a better coder, impress your boss, and scale you up in the employment industry, but it is in fact (while the difference is negligible) an optimization... <?php $a = [1,2,3,4,5]; // check speed of: ...


Top 50 recent answers are included