Skip to content

Instantly share code, notes, and snippets.

What would you like to do?



Readers and writers live under Y2Network::ConfigWriter and Y2Network::ConfigReader. For instance, the Sysconfig reader is Y2Network::ConfigReader::Sysconfig. The problem is that those classes can become quite complex easily: the reader needs to get configuration for interfaces, routing, DNS… so we usually need to split them into smaller, isolated and easy to test classes.

So we end up with classes like Y2Network::ConfigWriter::SysconfigDNS, etc.

Proposal 1

We could change the approach and put all the code related to the same backend in the same place. Something like having Y2Network::Adapters::Sysconfig which contains Reader, DNSReader, etc.

Proposal 2

Add another level like Y2Network::ConfigReader::Sysconfig and put the DNS reader into Y2Network::ConfigReader::SysconfigReader::DNS or something similar.


This comment has been minimized.

Copy link

commented May 10, 2019

Y2Network::ConfigReader::Sysconfig::DNS looks reasonable

And even something like Y2DNS::ConfigReader::Sysconfig.


This comment has been minimized.

Copy link
Owner Author

commented May 10, 2019

Well, you should not use Y2Network::ConfigReader::Sysconfig::DNS and Y2Network::ConfigReader::Sysconfig. The latter is a class, not a module so, although it is technically possible, it looks weird. To be honest, I prefer the Adapters or Backends (put your preferred name), but I do not have a strong opinion (my only concern is not to mess with classes and modules).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.