TheSwamp

Code Red => .NET => Topic started by: kdub_nz on November 12, 2022, 11:25:08 PM

Title: A Rose by any name . . .
Post by: kdub_nz on November 12, 2022, 11:25:08 PM
I've struck the inevitable roadblock.

What do I name a class.  ??

I'm (planning on) building an abstract base class for some purpose-built classes in a namespace.

The children classes are responsible for reading and writing config files . .

Well, actually, classes explicitly for
INI files,
XML files,
Registry entry

perhaps also
Config files,
Json files (or perhaps not)

The base class will contain common methods and fields for the derived classes.
I expect to be able implement most of the functionality in the base class

The issue is, what do I name the base class ?? ; something that represents what it is.
I have a couple of candidates, but they seem a bit lame-assed.

Regards,
Title: Re: A Rose by any name . . .
Post by: It's Alive! on November 13, 2022, 03:41:29 AM
use interfaces  :laugh:
Title: Re: A Rose by any name . . .
Post by: It's Alive! on November 13, 2022, 03:55:29 AM
AbstractFile
AbstractFileStream
BaseFileStream
FileStream : BaseFileStream, ISerializable


BaseFileStream : ISerializable
FileStream : BaseFileStream, IFormatter
Title: Re: A Rose by any name . . .
Post by: kdub_nz on November 13, 2022, 04:39:59 AM
use interfaces  :laugh:

Yep.  but I still use the base to handle the repeatable stuff.

Title: Re: A Rose by any name . . .
Post by: It's Alive! on November 13, 2022, 05:47:13 AM
I’ve been using Serialize a ton.
My last project I have a class ODBCSysVar, that implements Serialize
I call ODBCSysVar.Load in kInitAppMsg, and ODBCSysVar.Store in kUnloadAppMsg. It’s a singleton, with its own path, responsible for itself.
Something like this, I would name it after the data it holds.

BaseStream
INIStream : BaseStream
XMLSteam : BaseStream
RegistryStream : BaseStream
JsonStream : BaseStream

DisplayConfig
{
    read(const BaseStream stream...);
    write(BaseStream stream...);
}

just throwing out ideas  :mrgreen:
Title: Re: A Rose by any name . . .
Post by: kdub_nz on November 13, 2022, 03:41:00 PM
'Stream' may do it.

looks like that's another pack of jelly beans I owe you !

I had 'Config' and 'Profile' floating around in my head.
. . from configuration file and the Windows Profile API ( GetPrivateProfileString )

. . . pretty lame, and could be confusing.

Thanks for the input Dan

added:
Yes, I had proposed suffixing the <purpose> name with the <base> name , but I hadn't thought of actually prefifing the base name with 'base'.
The great thing is it's easy to refactor if I get hit by a creative bolt of lightning.
Title: Re: A Rose by any name . . .
Post by: kdub_nz on November 13, 2022, 11:42:23 PM
I found something that can be pannelbeaten into something near to what I think I want.

https://www.codeproject.com/Articles/5304/Read-Write-XML-files-Config-files-INI-files-or-the

. . . put on my overalls :)
Title: Re: A Rose by any name . . .
Post by: It's Alive! on November 14, 2022, 01:06:34 AM
looks like that's another pack of jelly beans I owe you !

Lol, I remember that! Back in the days where the sweetest thing for a thousand miles was Chinese red bean paste