X-Received: by 10.176.5.165 with SMTP id e34mr6186739uae.0.1463563437602; Wed, 18 May 2016 02:23:57 -0700 (PDT) X-Received: by 10.157.37.168 with SMTP id q37mr459521ota.1.1463563437390; Wed, 18 May 2016 02:23:57 -0700 (PDT) Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!11no4847445qgt.0!news-out.google.com!l67ni1409ith.0!nntp.google.com!sq19no6306753igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ruby Date: Wed, 18 May 2016 02:23:57 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.51.167.60; posting-account=bj9PDQoAAABOGmvJHTHNTl4b2srfmcmg NNTP-Posting-Host: 93.51.167.60 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Curious about some comments I received on some of my code From: ngw@nofeed.org Injection-Date: Wed, 18 May 2016 09:23:57 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3278 X-Received-Body-CRC: 1822084339 Xref: csiph.com comp.lang.ruby:7250 Hi, I recently took a coding challenge for a job, and as part of my applica= tion they sent me a coding challenge I had to pass. Today I received the answer, and I've been rejected. No big deal, I already= found a job I like a lot (and part of it will be in Erlang, yay!), but the= comments they made over my code left me... baffled. I would like to have i= f possible a code review (really not a lot of code) and some comments over = the issues they point out. The task was "Write a program that prints a multiplication table of primes = numbers." I will omit the one-liner Thor script that actually generates the thing, an= d post my implementation. class Fixnum def erathostenes starting_array =3D (2..self).to_a starting_array.each_with_index do |n, outer| (outer..(starting_array.count - 1)).each do |inner| if Fixnum.erathostenes_sieves?(starting_array[inner], starting_arra= y[outer]) starting_array[inner] =3D nil end end starting_array.compact! end end def self.erathostenes_sieves?(number, dividend) number % dividend =3D=3D 0 && number / dividend !=3D 1 end end Here is the class that prints the table: module FundingCirclePrimeTable class Table attr_reader :numbers, :rows def initialize(count) @count =3D count @numbers =3D @count.erathostenes @rows =3D @numbers.collect {|n| [n] + @numbers.last(@count - 1).map {= |i| (i * n).to_s }} end def to_s Terminal::Table.new(headings: @numbers.map(&:to_s).unshift(' '), rows= : @rows) end end end Yes, the attr_reader in the last class isn't needed, I added it for simplic= ity when writing tests, and at some point I used an each_with_index and for= got about the index, my bad, left some dirty when refactoring, my bad and I= count it as a problem in my code. They told me that "The feedback from the team showed that the tests provide= d complete coverage, however the code had a few issue regarding naming and = organising and contained quite a few clusters of functionality in a few lin= es." Also consider I'm not a native english speaker. What you guys think? Maybe it's because I opened Fixnum?... TIA, ngw