Author Topic: A Rose by any name . . .  (Read 2712 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
A Rose by any name . . .
« 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,
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: A Rose by any name . . .
« Reply #1 on: November 13, 2022, 03:41:29 AM »
use interfaces  :laugh:

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: A Rose by any name . . .
« Reply #2 on: November 13, 2022, 03:55:29 AM »
AbstractFile
AbstractFileStream
BaseFileStream
FileStream : BaseFileStream, ISerializable


BaseFileStream : ISerializable
FileStream : BaseFileStream, IFormatter

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: A Rose by any name . . .
« Reply #3 on: November 13, 2022, 04:39:59 AM »
use interfaces  :laugh:

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

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: A Rose by any name . . .
« Reply #4 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:
« Last Edit: November 13, 2022, 05:53:28 AM by It's Alive! »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: A Rose by any name . . .
« Reply #5 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.
« Last Edit: November 13, 2022, 03:49:50 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: A Rose by any name . . .
« Reply #6 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 :)
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: A Rose by any name . . .
« Reply #7 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