Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5469

Re: How to name class which will read and write configuration to file

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.programming
Subject Re: How to name class which will read and write configuration to file
References <4253758a-484a-424f-ac42-6fa2c2cffad4@googlegroups.com> <mk4ipq$24r$1@speranza.aioe.org> <9ux9x.13412$HS4.2372@fx07.iad> <mk6cql$u99$1@speranza.aioe.org>
Message-ID <VhH9x.6578$bM1.3874@fx01.iad> (permalink)
Date 2015-05-28 09:23 -0700

Show all headers | View raw


On 5/27/15 11:32 PM, August Karlstrom wrote:
> On 2015-05-28 07:13, Daniel Pitts wrote:
>> On 5/27/15 7:02 AM, August Karlstrom wrote:
>>> On 2015-05-26 23:39, pavelkastornii@gmail.com wrote:
>>>> I have a Configuration class and conf.xml file which contains
>>>> configuration data. I am thinking about naming class, that will read
>>>> data from xml-> java and write data java-> xml. ConfigProvider is not
>>>> good way as it suitable onlt for xml->java. ConfigReaderWriter is a
>>>> better, but maybe someone will suggest another variants?
>>>>
>>>
>>> Why not simply add the read and write methods to the Configuration
>>> class?
>> That is a terrible idea if this is a long-lived project.  What happens
>> when they want to support yml too? Or json? Or something else.
>
> If you try to anticipate every possible future change to the
> requirements your application will indeed be very complex. In this
> (unlikely) case I would rather let a separate tool handle the conversion
> to XML.
It really depends on the type of product you are creating, including the 
expected lifetime and user-base.

However, the "S.O.L.I.D" principles are often helpful regardless of what 
your system ultimately aims to be.

In particular, the "Single Responsibility Principle" seems relevant 
here.  A class that represents a Configuration, shouldn't also represent 
a ConfigurationLoader and ConfigurationSaver.

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to name class which will read and write configuration to file pavelkastornii@gmail.com - 2015-05-26 14:39 -0700
  Re: How to name class which will read and write configuration to file August Karlstrom <fusionfile@gmail.com> - 2015-05-27 16:02 +0200
    Re: How to name class which will read and write configuration to file Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-05-27 22:13 -0700
      Re: How to name class which will read and write configuration to file August Karlstrom <fusionfile@gmail.com> - 2015-05-28 08:32 +0200
        Re: How to name class which will read and write configuration to file Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-05-28 09:23 -0700
          Re: How to name class which will read and write configuration to file August Karlstrom <fusionfile@gmail.com> - 2015-05-28 21:25 +0200
            Re: How to name class which will read and write configuration to file Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2015-05-28 21:28 -0700

csiph-web