We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

9

If you are starting a greenfield project I would urge to start automated testing from the start. Doing everything TDD might be a challenge if the team has low experience with TDD. Still setting a minimum code coverage target of let's say 65% makes sure the code is testable. Why would you want to automate your tests: Being able to refactor the code safely ...


9

Tests should be independent of each other and reproduceble. This can be done with complete database setup for every test as you described or with a predefined database-content where a database-commit is not allowed and where all changes are rolled-back in the end (so database is not changed) or where the repository-database-implementation is replaced by ...


8

Laravel and AngularJS actually work quite well together; there's a good video on Laracasts about it and a few good articles online. In general you wouldn't want to use multiple MVC frameworks in one project as it increases bloat, as well as a lot of redundancy. Your average PHP MVC framework will include an ORM, Templating engine, router and so on - ...


8

There's a fair amount of debate in terms of when, where, and how to test an application of X complexity. And a fair amount of political zeal on all sides. In my own experience, I've been on a lot of projects that were small and simple, arguably requiring little automated testing. And truthfully, I developed with nearly zero automated testing and horrendously ...


8

The usual way to support multiple languages is to find some way for the two to talk to each other. This is very common in the web world; you might have a ROR site talking to an Android application. The conduit being used there is XML or JSON web services.


7

The real question you would have to ask is, "Why should I use an MVC pattern". The reasons for using such a pattern can only be explained when one has an understanding of principles that programmers want to adhere to for a number of reasons, but maybe the most important one: Seperation of concerns The value of separation of concerns is simplifying ...


7

I am asking myself the exact same question at the moment. I am leaning towards the multi-instance single tenancy solution but have not taken a definitive decision yet. Let me share some of my thoughts : The main historical advantage of the multi-tenant architecture is a better use of infrastructure resources, by mutualisation (single OS, single Database, ...


7

As is often the case, it depends With a pure JS framework you push a lot of processing to the clients. That means your webserver for the client application will only be serving static files that can be cached. your clients have to be able to handle that processing and need some amount of computing power your clients need to fully support all JS-features ...


5

Foreign keys in your database enables data integrity, as you can't delete a parent row if there is a child row in another table. While you can rely on the framework to handle data for you, the framework will not enable data integrity and you will eventually end up with orphan rows in your database. So, my advice is: design the database properly in order ...


5

As Wikipedia explains: It is a permissive free software license, meaning that it permits reuse within proprietary software provided all copies of the licensed software include a copy of the MIT License terms and the copyright notice. Such proprietary software retains its proprietary nature even though it incorporates software under the MIT License.


5

There is no need to reinvent the wheel and there are plenty of solutions out there that makes pushing notifications to mobile devices easier. I personally would recommend Firebase Cloud Messaging by Google which will work with both iOS, the Web and Android. It allows you to register devices and send push notifications using their API and plugins, and ...


4

You're doing it right The benefit is that you are actually testing the mechanisms which will be used when deploying to other environments; test, staging, production, etc. Each developer will be automatically verifying that environment specific configuration is working. I have tried the template approach and not checking in each developers configuration. ...


4

The data belongs to the organization, not the application. While right now you're using Laravel exclusively, in the future there might be several applications interacting with the database. I'm currently working on an app that started in FoxPro, migrated to ASP classic, and was partially upgraded to ASP.NET. There are at least three applications interacting ...


4

This is a classic use case for an abstract factory. You'd have a single interface and then separate concrete factories for each individual implementation. You'd then use factory methods to control the initialization of each set of factories.


4

Supporting both options is possible also (a pool of tenants across multiple instances). I favor multi-instance cause of the natural isolation. Each customer's instance runs in it's own processes and it's data is isolated in it's own database. You can upgrade instances to new versions on a per customer/instance basis when desired. Tenant based systems come ...


4

It is all a bit of semantics. A service would be a helper class, or in a sense a helper class would be a service. In terms of Laravel. Creating a service (which is a specific thing) would help code reuse and make testing easier. It is well worth getting over the hump of learning how to do. The number of services you need tends to grow as do the ...


4

You're confusing whereHas and with. The with method will let you load the relationship only if the query returns true. The whereHas method will let you get only the models which have the relationship which returns true to the query. So here : (new App\User)->with(['address' => function($query){// filter code}])->get(); will return all the users,...


4

I would not fault you for having three different controllers; there is absolutely nothing wrong with that. However, if you are feeling the need put each comment type in its own controller, there is a good chance your controller(s) are doing way too much work! Each action in a controller should only be a few lines, just wiring things up and directing the ...


4

It can be a bit overwhelming trying to come up with the right balance for your project. I'd like to help you with a framework of how to put it all in place. It starts with the customer Your product owner, or customer has a new feature they want in place. They do their best to describe what it means and you believe you have a good idea. At this point you ...


4

Far from being an expert, but I had the same question in mind for a while as well. This is what I have gathered. The generic (across languages) definition does emphasize that a trait can extend the functionality of a class. So if added to a class, the class indeed would not work without it. There is no clear consensus on it in the community (for instance), ...


4

In my opinion, you should add another abstract layer (for example, a repository) between the model and the client using it. I think it's better if we keep the model clean from infrastructure related code (quering database, calling API, ...). The following is my pseudo code, not in any specific language. The repository interface interface ...


3

I have answered this question on StackOverflow as well - I place my answer here for easy reference... The PRG pattern alone will not prevent this, as the P action in it takes time (which is usually the case) and the user can submit the form again (via click or browser refresh), which will cause the PRG pattern to "fail". Note that malicious users can also ...


3

Write two different UIs. Really. I work on exactly such a system every day, and the user experience for your User and Administrator personae are completely different. They're different because the needs of those users are completely different. Administrators will spend large parts of their day with your ticket list open in front of them, interacting with ...


3

You probably want to test a class that is using an eloquent model rather than the model itself. To create an in memory database for eloquent to query against in your test you want to do create a data base and then create your tables in it with some data to test against. use MyNamespace\ClassToTest; use MyNamespace\Models\MyModel; use Illuminate\Database\...


3

Although the right solution depends on your context, here is my approach: When designing classes one should always consider their single responsibility. In case of the PostsController it could probably be described "create, read update and delete" posts. Formatting of the output is a global problem of your application that should not be solved individually ...


3

One way is to explore micro-services. In this case, you can have part of your application written in, for instance, PHP, and other part of the application written in RoR. These two applications communicate through HTTP, probably using REST.


3

This form www.example.com/invite/123 is preferable when your URL refers to something concrete and specific, like a business entity, transaction or document. The word "invite" typically refers to a controller method. This form www.example.com?invite=123 is preferable when you want to modify the operation or resource at the designated URL using ...


3

Frameworks have come a long way. They're very powerful and get amazing things done. They've also become so ingrained into the languages they work with that employers have to mention them when advertising a job. That means you're not a java developer. You're a spring-java developer. Maybe you fight your frameworks to save your POJO's from corruption. ...


3

Your version control strategy seems fine, you just need a performance optimization for your migrations. You wrote Soon we find that some old project takes long time in running the migration file But why do you have to run the migrations more than once? Once the migrations are done to a specific intermediate version of the db schema of your dev database, ...


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