Context
What spurred this question was how I wanted to develop an API for reading a file system and creating pages out of these markdown files.
Clear definition of terms
(I know these definitions are arbitrary, but I tried to keep the title brief):
Hierarchical
Definition
All entities form a directed acyclic graph, or a simple tree. This is your file system. This is a REST endpoint. This is a URL (kinda).
Benefits
- Simpler to set up: does not require manually tagging or categorizing anything, as the file tree takes care of this
- Simpler to conceptualize: you know where each file is, so the file system is human readable, and it is WYSIWYG on the front end (assuming you are visualizing the entity relationships by displaying the file path, such as in a "News > US > Local" above an article about local US news)
- Requires no creation of an entity ID for the sake of lookup: the file path is enough, assuming you are creating a file system API
Non-Hierarchical
Definition
entities are grouped by categories and tags. This could warrant further discussion, but essentially by category I mean something that an entity only has one of. The category may then exist in a directed acyclic graph, or it may not. Tags, unlike categories, are something that an entity can have multiple of. Examples of tags and categories can be found in the wild and require no further explanation. Another example of a non-hierarchical entity is keyword search. The only non-hierarchical system I'm not interested in here is a totally flat system with no organization at all (I specifically said entity relationships in the title, so a flat structure with no shared tags/categories would just have no clear relationships at all between the entities).
Benefits
- If entities are moved, you don't break any links: assuming you use the file path as the unique identifier
- Files can be moved around for development purposes without affecting the UI: you can have folders called "TODO", "draft", etc without changing the categories of these posts on the front end.
- If you went the hierarchical route (file path routing), you could just add a "published: true" or "draft: true" to all of the files too.
submitted by /u/coolnavigator
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/kD30SWJ