20 May 2017
Couple of things about how I use controllers. I have seem many cases, many of them I’ve been part of where we extend the functionality of a controller beyond being that a REST endpoint with the usual CRUD operations and having more than that, which usually includes AJAX calls, some business logic, inclusion of third party libraries etc. So, how do we reuse them, well we don’t, we copy/paste the same if-else conditions and put that in another place/class/controller. And what do we do when we change something about it later down the road, well we find/replace that and we’re done, with that we might mess something up but the testers will find it and we will fix it. This has been done for too long and for too many times.
Continue reading...
16 Aug 2016
Having the code decoupled seems like the way to go for re-usability outside the scope of a framework. That’s the main reason I prefer Symfony, I think it has the best approach since you can easily use some of its components someplace else in some other framework or as is.
Continue reading...
15 Aug 2016
Most of the framework today are using the ORM approach when it comes to designing their modules/bundles. They would create a class which private or protected properties represent columns in database table. So ORMs would provide CRUD and auto-generate public functions for listing, creating, updating or deleting a record from the table that module lives on.
Continue reading...
15 Aug 2016
Writing unit tests is divided into two categories: TDD (Test Driver Development) and BDD (Behavior Driver Development). But, first let me write some things about its importance positive or negative.
When I get a requirement I dive into the implementation previously having the design of the classes and the databases in mind or simple wrote on paper. Nobody has time for writing tests. That’s the first mistake I usually make. Before the requirement is finalized it is being estimated together with business analysts and managers. So, having in mind that we need to put some extra hours for the writing of tests, the estimations might become bigger and scare the client, even more don’t accept that release since usually developers are charged by hours.
Continue reading...
20 Jul 2016
We have multiple ajax requests that need to be executed one by one. Each of the ajax requests is run after the success of the previous ajax. This usually happens when we want to get something from API, display some information and do another action and so on in multi nested levels.
Continue reading...