Menu

1 / 2

Self-similar: a versatile folder pattern for code

DEV Community·Jonathan·6 months ago
#A5J1rsAe
#folders#code#software#coding#structure
Reading 0:00
15s threshold

“The word 'isomorphism' applies when two complex structures can be mapped onto each other, in such a way that to each part of one structure there is a corresponding part in the other structure, where "corresponding" means that the two part play similar roles in their respective structures.”

– Douglas HOFSTADTER

Gödel, Escher, Bach • Meaning and Form in Mathematics • pp. 57

I've seen various trends come and go in code folder and file structure.

The two big ones in the front-end space seem to have been:

Function-focussed.

📁 controllers

📁 views

📁 models

etc...

Feature-focussed.

📁 posts

📁 comments

📁 likes

etc...

There have been various efforts to combine them, such as the feature-sliced design .

For example, we can have:

📁 posts

📁 controllers

📄 list.ts

📄 detail.ts

📄 create.ts

📄 delete.ts

📁 views

📄 list.tsx

📄 detail.tsx

📄 create.tsx

📄 deleted-message.tsx

📁 models

📄 post.ts

📁 comments

📁 controllers

...

📁 views

...

📁 models

...

📁 likes

...

Overall I…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.