Skip to content

Latest commit

 

History

History
31 lines (18 loc) · 2.04 KB

ANSWERS.md

File metadata and controls

31 lines (18 loc) · 2.04 KB

Attack Vectors

Short URL Guessing: Mitigated by using secure random generation. SQL Injection: ActiveRecord mitigates this by using parameterized queries. Denial of Service (DoS): Rate limiting can be implemented with middleware like Rack::Attack.

Scalability

Database Sharding: Distribute URLs across multiple database shards. Caching: Use a caching layer (Redis) for frequently accessed URLs. Load Balancing: Use load balancers to distribute incoming traffic across multiple server instances. Asynchronous Processing: Offload URL processing to background jobs if the load is high.

Open-Ended Questions

  1. Please, explain your own words how you understand the DRY principle — Don't Repeat Yourself.

Any code you write should be written only once. Well, if you have a lot changing requirements, probably 2 or 3 times are fine, but more than that should always be considered for refactoring. Tests included.

  1. What is your least favorite recommendation in the community Ruby style guide? https://rubystyle.guide/ Please, explain if you have one.

Not possible to remember everything, just use rubocop.

  1. Please, share a situation when you experienced working with a difficult coworker on a team. How was the coworker difficult and what did you do to resolve the situation to encourage the team's ongoing progress?

I don't think there is such a thing as 'difficult' coworker. It's always about the communication between the team members.

  1. Please, explain what is a dependency injection (DI). What place may it have in a typical Rails app? How would you structure a rails app to utilize dependency injection? If you think DI is not useful in Ruby/Rails applications, please, explain why.

DI is a design pattern which allows the dependencies of a class to be provided from outside. It is not so commonly used in Rails apps, mostly in tests. But in some rare cases in might be very useful. For example I worked with multi-regional app and implementation of some dependencies in various regions might differ, so I would inject the dependency based on the current region.