#Thin .Vs Core .Vs Raw... How to name a base struct...?

3 messages · Page 1 of 1 (latest)

wide bronze
#

I've been refactoring some code today, by breaking out fields of a struct, into components which handle more specific aspects of the overarching struct's behaviour, but I've run into a case where I'm somewhat questioning the naming I've chosen for the structs when it comes to one of these sub-components, which is central to the behaviour of the overarching struct...

Initially, I've named this new struct with the prefix "Thin", in reference to the fact it encapsulates a "thin slice..." of the ""core"" behaviour of the overarching struct, providing another potential prefix in "Core"... I also thought to the RawVec struct implemented for the alloc crate, providing the implementation details for the public Vec struct as similar, providing the potential prefix of "Raw"...

Upon consideration though, I'm not sure any of these entirely accurately describe the intent behind having broken it out into a distinct struct, as whilst the initial struct is reliant on the behaviours of this new struct, the new struct is designed in such a way as to be usable as a standalone component, rather than simply the "Core" of another struct. Similarly, "Thin" comes with something of an impression of being a handle to, or vertical slice of, something else, which this struct shouldn't be exclusively treated as... "Raw" on the other hand, gives me the impression the struct is an internal component which should be wrapped in an outer implementation for exposure as a public interface...

Which of these would be best suited to describe this new struct, if any? Or are there other naming suggestions, which may be more appropriate in this case...?

delicate sparrow
#

Base could be a valid name, but there's also precedent for using Raw as a component that can be used somewhat on its own

#

(RawTable in hashbrown, RawValue in serde_json)