Ruby Digest:
Self-criticism, RubyMine, and charts

Feb 6, 2023
Share:

In this digest, we will discuss the rubycritic tool, take a look at the new RubyMine interface, and discuss some data visualization utilities. We strive to make your Ruby experience fun!

Constructive criticism 

Everyone loves when their work is praised. But when it comes to criticism, most people take it negatively. Even if it is constructive, it can be difficult for many to process it correctly. Developers are forced to show their code to colleagues and face judgment. On the one hand, this provides an opportunity to improve the quality and development process. On the other hand, it can create discomfort. 

There is a difference between "show the code to a person" and "show the code to the program." Developers read code all the time — more often than they write it. Therefore, showing your code to a colleague and asking for comments is a great idea. On an ongoing basis, linter applications are also engaged in checking and improving the code. But in addition to them, in the world of Ruby development, there are such utilities as Reek, Flay, and Flog

The first of these, Reek, is looking for "the code that smells" — potentially problematic sections of the code. The second analyzes the code for the presence of structurally similar sections, identifying potential candidates for refactoring. And the third analyzes the complexity metric. Using all three of these utilities, you can get an unambiguous conclusion about the quality of the code. 

But developer Guilherme Simões has made the self-checking process much easier by creating the rubycritic project. In it, he combined the capabilities of the above utilities, adding a convenient interface for viewing the results. The tool checks the code and generates a detailed report on all found problems. All that remains is for the developer to review it and identify areas that require improvement or a complete overhaul. In most cases, this will help to obtain an objective assessment without human input.

New UI in RubyMine 

JetBrains is rapidly preparing to migrate RubyMine to the new UI. There is nothing worse than the unknown, so the update was not kept secret. The new interface is fundamentally different from the previous one. For comparison, RubyMine's main window with the old and new interface:

RubyMine_1
RubyMine_2

The window title has become much simpler. The developers have relocated all sections of the menu under a single button with a "hamburger" icon. In their place are the project, version control, and launch widgets. The navigation bar has moved down to the status bar. Most of the icons have been redrawn to improve visual balance and readability. The font was changed to Inter, which is already actively used in other JetBrains products. Visually, the interface has become less overloaded, allowing developers to concentrate on the code and not be distracted by unnecessary and rarely used elements. 

Drawing charts 

If you need to draw a chart using Python, then in most cases, developers and data analysts turn to the matplotlib library. Even for people who aren’t programmers, it is usually not difficult to build a simple chart from ready-made data in just 8 lines of code. Professionals get an extensive set of tools that can visualize any data. But how do you create charts in the world of Ruby development? 

Well, there are some interesting utilities you can use. For example, YouPlot, which is based on the unicode_plot library. This is a great option if you need to load a data file with one command, sort it, and output it as a beautiful graph or chart directly to the console.

Drawing charts

Rails boasts the Chartkick tool. It allows you, literally with one line in Ruby, to display the desired chart. It can be a line chart, a pie chart, or a bar chart — there are numerous options. The emphasis is on stopping developers from wasting time fighting visualization libraries. Most tasks are solved without the need to study the documentation carefully, and each graph and chart can be configured with a dozen different options. 

After installing the gem and a simple environment setup, you can test the tool: 

<%= line_chart User.group_by_day(:created_at).count %> 

Please note that for the group_by_day method, you need to install another gem — groupdate

The output will be a sleek line chart:

Drawing charts 2

Meetups

Singula Business & Management Meetup
Feb 16, Dubai

We are glad to gather the Dubai tech and business community together! We are providing a place to connect and network with international thought leaders and software development professionals. Equip your team with new methods and tools and take your projects and management skills to a new level! 

What are the best product management methodologies? We will discuss what to choose among the many different frameworks available for tech startups, such as Agile + OKR, focusing on the Continuous Discovery process for products. 

How have today's top tech companies and corporations successfully brought their tech products from the planning stage to launch a scaling up? Our speakers will cover the successes and challenges that the leading tech product brands face and how you can learn from them. 

We'll also share insights on how to evolve from micromanagement practices to solid and transparent team processes. Finally, we will explore the value of a streamlined system for collecting team performance metrics. 

Don't hesitate to join us for three inspiring talks about management challenges and hot conversations over a cup of coffee! 

Registration is free of charge!

More info

Share:
Important
technology news and events
SubscribeFollow RSS ↗