Skip to content

Commit e77ae75

Browse files
committed
Add a blog 💭
1 parent 3dfcf0f commit e77ae75

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Documentation:
2929

3030
* Rename `User Guide` to `Tutorial`
3131
* Restructure the API docs index page
32+
* Blog!
3233

3334
Miscellaneous:
3435

docs/blog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Blog
2+
====
3+
.. toctree::
4+
:glob:
5+
:reversed:
6+
7+
blog/*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Why is the keyword class hierarchy flat?
2+
========================================
3+
*Wed 08 Mar 2023*
4+
5+
In developing jschon, I’ve drawn a lot of inspiration from two great Python
6+
libraries that I use extensively in my day job: Pydantic and SQLAlchemy.
7+
8+
Applications that use Pydantic or the ORM paradigm in SQLAlchemy are easy to
9+
spot: you’ll find a collection of declarative models, each derived from a
10+
quintessential base class provided by the library - :class:`BaseModel` in Pydantic,
11+
:class:`DeclarativeBase` in SQLAlchemy. A given application might define a model
12+
hierarchy to roll up common behaviours, but that would be private to the
13+
application and, in general, should not affect the relationships between the
14+
declarative models and other foundational entities in the library. One of the
15+
great things about implementing declarative models using these libraries is
16+
that I know that I can just derive from :class:`BaseModel` or :class:`DeclarativeBase`,
17+
I don't have to know which is the most appropriate abstract subclass to use,
18+
and I don't need to be aware of any variance in implementation higher up in the
19+
hierarchy. Another great thing is that each model is completely self-contained
20+
and completely self-descriptive.
21+
22+
In jschon, keywords are analogous to declarative models, with :class:`Keyword`
23+
being the quintessential base class. One might argue that declarative
24+
models are conceptually more analogous to schemas, and model fields to
25+
keywords, but I'm looking at things from a programming workflow perspective: as
26+
declarative models are the building blocks of a Pydantic / SQLAlchemy
27+
application, so keywords are the building blocks of a vocabulary
28+
implementation. Taking the analogy further, a given vocabulary might define a
29+
keyword class hierarchy to roll up common behaviours, but that should be
30+
private to the module, extension or application that implements the vocabulary,
31+
and should not affect the underlying relationships between keywords and other
32+
foundational entities in the jschon library. From the perspective of those
33+
other entities, a keyword is a keyword is a keyword, and from the perspective
34+
of the vocabulary, a keyword is self-contained and self-descriptive.
35+
36+
*marksparkza*

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
testing
1010
contributing
1111
changelog
12+
blog

0 commit comments

Comments
 (0)