When to Create Classes? Do Java Programmers Over Use Classes

Some people said “there goes the neighborhood” when rails came on the
scene since it attracted everyone from former Java programmers, PHP
programmers and even designers. Not to mention total newbs like
myself weaned on rails.

Right now I’m working on a project with a Java veteran (10+ years)
who’s new to rails and ruby in general. We’re working on a so-called
“enterprise” project to sell available space (I’ll leave it to your
imagination). Developing with him drove me up the wall until I just
gave up on learning anything and getting the project done rather than
writing code I can be proud of.

Dude wants to turn everything into a class and corresponding table
with disregard for YAGNI. A case in point is we have three different
stakeholders making transactions that fulfill various roles as well
(like admin). Now all these stakeholders belong to a company
(obviously, as it is a B2B system) which will have common attributes
like address, tel, fax, url, name. To me I’d rather use a Company
class to hold his info and tie that together with the various
stakeholders and reuse it for other classes that might benefit from
associations rather than duplicate the info across the app. The
company class itself is not all that important to the application and
is basically there to ensure there is one unique instance per company
(don’t want 20 different Apple Inc.s being added to the app).

That might be a matter of taste but it seems to make the application
logic more complex because we can’t call the same associations since
we now have ClientCompany, UserComany, etc. Basically he’s afraid of
making the app brittle and doesn’t like the fact that it makes the
class diagram generated by the railroad gem complicated looking.

Another example is we’re going to have some restrictions on the
transactions based on groups like industry, company, etc. My thought
is to simply make a polymorphic join like BannedList with banned_id &
banned_type but he’d rather create a separate class per type.

I leave the dude alone and he starts making even more classes before
trying to see if we can squeeze something out of the base class before
we really have to separate it into a domain. It wasn’t supposed to be
a complicated system.

The problem is I don’t have enough seniority or experience for a full
on confrontation. All I can say is that the project’s getting more
tedious and hard to comprehend for no reason. I’d like to know what
others think and if anyone’s having similar experiences (even from the
other side like, " these newb ruby progs don’t know nothing about
coding").

Cheers,

Sam

PS I’m looking for a job because of this (just to be safe).

SB wrote:

Some people said “there goes the neighborhood” when rails came on the
scene since it attracted everyone from former Java programmers, PHP
programmers and even designers. Not to mention total newbs like
myself weaned on rails.

The problem is not with Java its with him not being Agile and Pragmatic.
10+ years means nothing if in that time all you’ve picked up is bad
habits.

I too would use the polymorphic association model for the situations you
describe. If the domain proved more complex down the line you would
refactor individual at that point.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs