AstonJ

AstonJ

Will being able to organise/work on individual components of an app by component directories be possible with Hologram?

Interesting - I hadn’t thought of it like that, but I guess if Hologram is always going to ship with Phoenix then you’ll always have Phoenix and all of its benefits. This does sound very appealing!

And in that case something I would really love, and not sure if Bart has thought of this, is a way to build my apps as a series of components. I think Phoenix Contexts does this in a way, but I’d love to build apps as a series of components that are reflected in the directory structure. Many frameworks are centred around directories for Models/Views/Controllers etc, but I’d like directories for components and then each related file in there, with MVC directories if need be. This just makes it easy to work on individual parts as well as easily being able to slot in/out different versions (which could be almost nothing like each other). It just feels right to me and I think would be very attractive to developers as working on individual parts of an app in this way would feel a lot less overwhelming than working on one big one, enabling solo devs or small teams to tackle or focus on one thing at a time, rather than the whole thing.

Most Liked

bartblast

bartblast

Creator of Hologram

I think what you’re describing is vertical slicing architecture - and I have great news! This is exactly what will be possible in the standalone Hologram version. Actually, supporting this kind of structure is one of the key reasons why standalone is needed.

Here’s how it will work:

When you generate a new project with the Hologram project generator, you’ll start with a horizontal slicing structure - all your app directories organized by technical layers (pages, components, services, etc.) in one flat folder structure.

But as your application grows (or really, whenever you want), you’ll be able to switch to vertical slicing and reorganize the app folder into feature/domain directories like shopping_cart, accounting, etc. Each subfolder would have its own subdirectories for pages, components, services, tests, and so on.

I think it usually makes sense to start with horizontal slicing because in the beginning you don’t always know exactly what you’re building, and this way you can save time not overthinking boundaries (similar to how you’d start with MVC). Later, once the application grows and patterns emerge, you can reorganize the code better.

Note: Vertical slicing won’t be possible in the first standalone version, but it will be supported eventually.

So Hologram will have two modes:

  1. Embedded - where you use Hologram alongside Phoenix or even together with Phoenix LiveView
  2. Standalone - very simple to use, with a very simple structure, no configuration needed. Just install and start adding features.
AstonJ

AstonJ

Ah this is awesome! For me, being able to tackle and focus on one part of an app at a time is a huge plus - not just in the initial make-a-start phase (far less overwhelming if you break an app into smaller components) but I feel you are also more likely to actually spend more time on each component as well as continuing to go back to them to refine them, because they’re self-contained meaning you don’t have to overstretch your bandwidth (which at times can often be limited if we’re busy/stressed out/working towards deadlines/etc).

Let’s split these posts into a separate thread in case anyone else is curious or wants to add their thoughts too :icon_biggrin:

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43757 214
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement