Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why you should check your gem's lines of code

In April, the author shared an idea on the Dead Code podcast about using the number of lines of code in gems as a useful metric when evaluating them. The concept is to imagine the implementation in terms of lines of code, then generate a cloc count to see how accurate the estimate was. If the actual lines of code were less than expected, it could indicate interesting implementation that could be learned from.

If more lines of code were expected, it might suggest the implementation is more complex than anticipated. The author has been focusing on writing gems with clear concepts to naturally limit complexity, resulting in "breezy reads" that can be understood in less than an hour. Examples include ActiveRecord::AssociatedObject and ActiveJob::Performs, both under 100 lines of code.

The author found a useful way to categorize gem ideas based on line count, aiming for gems to stay within perceived worth. While lines of code isn't a 100% reliable metric, the author believes the approach has provided useful insights and clarity in evaluating and writing gems.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at spinel.coop →

More in Tech

ITCN Asia attracts 3,500 global brands

KARACHI: Some 3,500 global brands and more than 350 international delegates and investors are participating in the 28th ITCN Asia, being held at the Karachi Expo Centre with the support of the Special…

More from Thursday 24 September →