Sitemap

Code organization style in Semaphore

Interview with guys from Rendered Text

3 min readJun 9, 2014

--

I decided to collect stories about how different ruby teams and developers manage complexity of their ruby applications.

And as a result of my previous post, I was happy to spend a day in the office of company named Rendered Text. If you’re not familiar with their product Semaphore yet — just go and check it.

I asked the team everything I wanted: about the company, product and their code. Now I am happy to share it.

1. About the company

Press enter or click to view image in full size

— Rendered Text story started five years ago. Now we’re product company and stopped doing work for clients. We launched Semaphore two years ago. And we were developing it for almost year before launch.

We always wanted to do our own product, and we waited for good timing for that. We recently grew up and current team size is 8 people.

2. About the product

— Even before we started this product and were doing consulting, we started some kind of social network for sharing events. If we were doing it now, it would be called a startup. But it required a lot of marketing work, which we couldn’t do right at that point. So doing our own thing is something we always wanted to do.

Get Ivan Nemytchenko’s stories in your inbox

Join Medium for free to get updates from this writer.

— What are your next plans? Do you plan to launch more products? No, we plan to focus on Semaphore. We have some ideas, to make it more than just CI. Moreover, we’re on billion-dollars market, and we don’t have our billion yet ☺

Marko Anastasov (@markoa) and Darko Fabijan (@darkofabijan) at their workplaces

3. And the most interesting part: the code

— Our Rails code organization style is guided by Single Responsibility Principle.

— We treat the principle as a guide and don’t go to the extremes — models still have some business logic. It’s fair to say we try to keep both controllers and models skinny. Services implement use cases — the bulk of work.

Several things sprout from following the style:

  • A controller method never performs more than a single CRUD action. It calls a service that talks to domain objects and other services to perform a task.
  • There are less model callbacks. Factories are used to setup a model instance correctly.
  • Authorization layer is separate from controllers. For authorization we use Pundit.
  • One line Rake tasks. A task calls a service that performs the weightlifting. Testing Rake tasks is straightforward — you write a test only for the service.
  • Domain related code and services live in lib/appname directory.

This was the first post on code organization style. I’ll come with more of these soon. Follow me to be notified about new posts. Want to share your story? Drop me a line.

— Ivan Nemytchenko, ruby code anthropologist :)

--

--

Ivan Nemytchenko
Ivan Nemytchenko

Written by Ivan Nemytchenko

IT events enthusiast & productivity geek