Skip to main content
18 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
  • 28.4k
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.4k
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,132
11 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
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,250
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
  • 12.1k
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
  • 79.9k
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
  • 79.9k
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

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
  • 78.5k
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

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,425
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

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

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

Is the URL 'users/new' RESTful?

REST doesn't care what spelling you use for your URI Stefan Tilkov REST: I don't think it means what you think it does Example: when you submitted this question to stack exchange, adding a "...
VoiceOfUnreason's user avatar
3 votes

What is less desirable: Inefficient code or maintenance overhead?

If you are using an SQL database, you can be sure that this database is really fast at running a query that filters out say 100 out of a million users. Thousands of developer man years have been ...
gnasher729's user avatar
  • 46.7k
3 votes

How to efficiently process CPU intensive tasks on the server in the background

Rails has a built-in framework for background task processing, so lengthy tasks don't block the controller from returning a response to the client. It's called Active Job. (See: https://guides....
Alex D's user avatar
  • 1,308
3 votes

Rails model inheritance without STI or polymorphism?

The Rails API states: If you don't have a type column defined in your table, single-table inheritance won't be triggered. In that case, it'll work just like normal subclasses with no special ...
randmin's user avatar
  • 131
3 votes
Accepted

Best way to renew OAuth token before expiry

Before you use the token, check the expiry date and request a new token if required. After you use the token, if you get a expired response, request a new token.
Ewan's user avatar
  • 78.5k
3 votes
Accepted

Reorderable parent/children hierarchy in a relational database

Rather than the entities, let's look at the relationships here: An Item is for exactly one Room; a Room has many Items An Item is for exactly one Section; a Section has many Items A Room has many ...
IMSoP's user avatar
  • 5,877
2 votes

Rails - Does using partials slow views rendering?

Working on a Rails 4.2 app right now where a slow action that was taking about 745ms on average. When I remove the code from the partials and place it into the main template, the time it takes is now ...
Sammy Larbi's user avatar
2 votes

Should I keep separate client codebases and databases for a software-as-a-service application?

One app code base, one database schema, but probably run the apps separately and have the dbs use the same schema actually be different db instances. Don't design for it now, but you could imagine ...
Bradford Medeiros's user avatar
2 votes
Accepted

database architecture for ecommerce app

This is a pretty typical inventory management problem. How you manage it depends on how you physically manage inventory. If each item (not SKU, but item) has a unique serial number, then you may be ...
Tom Harrison Jr's user avatar
2 votes

Can a model have itself as a foreign key?

For those who are still looking for the how-to in Rails.
Ken Ratanachai S.'s user avatar

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