stevensonmt

stevensonmt

What's a good example of a lib that only provides a behaviour and type definitions?

I’m trying to refine a simple example of an ECS implementation by defining behaviours for each element of the ECS pattern. I’m just curious about the best way to organize modules, examples, and tests.

Most Liked

al2o3cr

al2o3cr

Behaviours without code that consumes them seem odd; usually they are used to communicate “this generic functionality needs the following callbacks for your specific needs”, like how you implement the GenServer behaviour and then pass that module name to GenServer.start_link.

thiagomajesk

thiagomajesk

Hi, @stevensonmt!

I’m trying to introduce this approach in a project I’m working on to make business logic a little more explicit and to help onboard new developers. It goes something like this:

One project holds all the contracts that define how we interact with “objects” from the domain, those behaviors act like interfaces, that are later implemented by the “real” project, which must satisfy the specification. It’s pretty straightforward.

Another good example that you already mentioned, is how adapters in most library work.

BTW, IIRC a library that also does something like this is Cameonin; which is just a specification for password hashing libraries.

PS.: If you are planning on implementing ECS using processes, bear in mind that your might have a bottleneck. I’d recommend watching this video about it a Dwarf Fortress simulator in elixir:

stevensonmt

stevensonmt

Thanks! Comeonin is exactly what I was looking for as a model. Regarding the ECS implementation, this is really just a learning exercise so I’m not too worried about the bottleneck potential right now. I’ll check out the video though to avoid any avoidable design mistakes.

Where Next?

Popular in Discussions Top

Qqwy
I would like to spark a discussion about the static access operator: .. For whom does not know: it is used in Elixir to access fields of...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
acrolink
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 14027 124
New
Ankhers
Just a little information upfront. Generally speaking, if I feel like I need to either break a pipe chain or use an anonymous function in...
New
100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
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
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement