36 votes

When to use inheritance, when to use 'just a boolean field'?

You want to avoid base classes knowing about derived classes. It introduces tight coupling and is a maintenance headache because you have to remember to add to the list every time you create a new ...
17 of 26's user avatar
  • 4,828
17 votes

Convincing a development team to use a better design pattern

This is probably more suitable for careers but joining a company and immediately telling them to change the way they do things is a really going to be tough. It's unlikely anyone is going to listen ...
JimmyJames's user avatar
  • 27.3k
14 votes

What is less desirable: Inefficient code or maintenance overhead?

Good code, Works, Is easy to read, test and maintain. In that order. The only reason to favour efficient code over easy to maintain code is if that inefficient code doesn't work. So go with that ...
David Arno's user avatar
  • 39.3k
13 votes

When to use inheritance, when to use 'just a boolean field'?

and specify a list of subclasses that are blocking inside the Notification parent class. That looks very peculiar and is a particular code smell. I would provide subclasses if you have differences ...
Brian Agnew's user avatar
  • 4,686
12 votes

Does RESTful response always return a 404 and empty content when an array is expected but the result is empty?

You're right, the behavior is indeed strange. A null and an empty array are, semantically, two different things. An empty array indicates exactly that: the array exists but contains no elements right ...
Arseni Mourzenko's user avatar
12 votes

Best practices for internationalization: composed sentences?

If you want internationalization that isn't infuriating/weird/offensive/confusing to users, you do one of two things: you take the entire block out and have the copy translated in one go per item, or ...
BrianH's user avatar
  • 6,122
10 votes
Accepted

Convincing a development team to use a better design pattern

You know, this: Convincing a development team to use a better design pattern Is a fair bit different from this: I recently joined a company where I was tasked with building a system for one of ...
candied_orange's user avatar
8 votes

Using multiple languages

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. ...
Robert Harvey's user avatar
8 votes
Accepted

Decoupling REST API and frontend web application

I can't speak for Twitter and Github, but I can speak for Stack Overflow. I wouldn't worry about "scale" as an abstract possible idea. I would worry about your present and provable needs from the ...
Sklivvz's user avatar
  • 5,260
7 votes

When to use inheritance, when to use 'just a boolean field'?

As a converse to the existing answers, I would suggest that the boolean property is the best option if the mode that is to be used is required to be changed dynamically (e.g. via a configuration file ...
Jules's user avatar
  • 17.8k
6 votes

Argument for staying on Rails instead of migrating to .net MVC?

You can give counter examples of large scale applications. With its 40.1 million users, GitHub is one of them. It is written using Ruby on Rails, and it doesn't seem to suffer a lot with the ...
Arseni Mourzenko's user avatar
6 votes

Convincing a development team to use a better design pattern

Your past experiences with other companies may indeed tell you what works to solve the kinds of problems that those companies experienced, but does the company you've joined suffer those same problems ...
Ben Cottrell's user avatar
  • 11.7k
6 votes
Accepted

Implementing A "Draft" Mode For Posts

The simplest alternative would be the is_draft property approach, since you would benefit of all the existing code, and a simpler maintenance, the day you would want to add new fields or behaviors to ...
Christophe's user avatar
  • 77.2k
6 votes

Best practices for internationalization: composed sentences?

Basic principles The sentence structure and grammatical subtleties can indeed make the internationalization exercise difficult. The core practices that you'll need to use in all the cases are: ...
Christophe's user avatar
  • 77.2k
6 votes

Tracking flakey tests in Ruby on Rails / Rspec - is there a way to do this?

Flakiness comes from randomness, the sources of this randomness might be different. But let's not focus on that, let me give you a guide I learned from an awesome engineer who is a SO user I need to ...
Greg's user avatar
  • 445
5 votes
Accepted

How to implement a (truly) global variable in a Rails app

You already got the right answer yourself. Store it in a Database and consume it as you need it. As for the approach of database, you also got the best answer yourself: using Redis for performance ...
pietromenna's user avatar
  • 1,148
5 votes

Benefits of using a JS Framework

As with any other question to adopt a technology - it depends on the technology. It depends on your requirements. It depends on any future requirements/the roadmap for the product. It somewhat depends ...
JᴀʏMᴇᴇ's user avatar
4 votes
Accepted

How should Rails be set up with an SPA client like Aurelia?

The technical benefits of multi-repo are fairly minor: smaller repositories, faster clone times, possibly improved performance on CI, but nothing that should make a real impact on anthropic scales. ...
lotyrin's user avatar
  • 56
4 votes
Accepted

Between JS clients and a Unity game server : TCP or UDP?

UDP vs TCP UDP is lightweight, stateless, and lossy. TCP is heavy, statefull, and robust. UDP is best when transmission errors can be ignored. TCP is best when transmission errors need correction. ...
candied_orange's user avatar
4 votes
Accepted

Argument for staying on Rails instead of migrating to .net MVC?

Sorry, yes its slow. https://www.techempower.com/benchmarks/ However, as noted performance of the language probably isn't very important compared to things like good database design and code written ...
Ewan's user avatar
  • 75.6k
4 votes
Accepted

Reconciling MVC with a strategy pattern

The MVC design pattern does not specify the mechanics involved in choosing which view to render. Both ways are "MVC". If you are rendering a collection of books, the controller renders a single view ...
Greg Burghardt's user avatar
3 votes

Where to store configuration URL variable in Rails?

I store configuration variables like these in YAML files and then load them into the app's configuration in config/application.rb. I believe this is a standard practice. Example I configure a URL ...
David Gay's user avatar
  • 131
3 votes

Where to store configuration URL variable in Rails?

Configuration data like this should always be stored in a configuration file. I have the below line in all my rails applications: # config/application.rb config.app_config = Rails.application....
Khaja Minhajuddin's user avatar
3 votes

Using multiple languages

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 ...
Gustavo Pinto's user avatar
3 votes
Accepted

Rails' MVC vs Microsoft MVC - where to put logics?

In the Microsoft version of MVC, you have the heavy Controller implementation instead of the heavy Model implementation that a large portion of the development community uses. The ORM should be a ...
Adam Zuckerman's user avatar
3 votes

MVC - Database search logic in View or Model

The View is responsible for displaying data and accepting input from the user. The Controller is responsible for accepting requests and directing them to the proper method in the model for performing ...
Robert Harvey's user avatar
3 votes

Does RESTful response always return a 404 and empty content when an array is expected but the result is empty?

Don't forget that 4xx errors are client errors, per HTTP specification. It really comes down to do you want to tell the client that its request was wrong, or do you want to say you don't have anything ...
imel96's user avatar
  • 3,518
3 votes

Rails - Does using partials slow views rendering?

Even if you have no n+1 problem and do all the database work up front (say with a recursive CTE), nested partials are still very slow. Haml and Erb both look slow to me. On Rails 5.1.4 I'm seeing a ...
Paul A Jungwirth's user avatar
3 votes
Accepted

Database design for a role based access system?

Having a separate Role table lets you perhaps create "global" roles and then attach users to the role. But is it really worth the performance hit and added complication vs letting the roles ...
JeffO's user avatar
  • 36.8k
3 votes

Should I structure/process data for a view in an MVC architecture?

I prefer putting as little logic in my views as possible. Yes this bulks up the size of the controller, but you can counteract this by splitting it up in multiple methods, functions or classes, as you ...
bigblind's user avatar
  • 1,415

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