jessejanderson

jessejanderson

I’ve been reading Lance Halvorsen’s new beta book “Functional Web Development with Elixir, OTP and Phoenix” and it’s got me thinking about new ways of using processes.

In the book, you build a battleship-clone, and the gameboard you build is built with coordinates - each of which is its own process. The advantage you get out of this is that each coordinate is independent yet can hold it’s own state, and also a coordinate exists independent of any sort of heirarchy. Since it is just a process, it can be a part of different branches of data and easily read / updated.

I was wondering if it would be possible to do the same sort of thing with a calendar app. Each date could be a process that stores the events/times happening that day, one advantage being that you could potentially check for room conflicts when creating a new weekly event that just calls up the processes associated with the dates you are scheduling to check for any potential conflicts.

Obviously, one huge issue with this thought process is timezones - so maybe it’s an entirely wrong-headed approach.

My work currently has several calendar apps built in Rails and finding/resolving conflicts is one of the biggest sluggishness factors - so that is definitely one factor that I’m trying to find a solution for.

Just sort of spinning this stuff around in my head and wondering if anyone has any thoughts or ideas for a way to take advantage of OTP in a scheduling/calendar app. :slight_smile:

Showing Posts 1 to 10

dom

dom

Why is finding conflicts sluggish in the Rails app?

jessejanderson

jessejanderson OP

Heh, actually I have no idea - I’m actually not super familiar with Rails.

Honestly, I’m more focused on “how to think about a scheduling calendar within OTP” than specifically fixing problems with the Rails app, though that is what sort of sparked this.

radar

radar

I couldn’t think of a reason for the finding or resolving of conflicts to be difficult. With a liberal use of PostgreSQL’s OVERLAP operator (PostgreSQL: Documentation: 9.0: Date/Time Functions and Operators) it should be fairly trivial to do.


Now regarding this OTP app idea of yours. What kind of granularity would the processes have? I can’t think of a level of granularity that would actually work for this example, hence why I ask. You couldn’t have a process per hour because then what if an event spans multiple hours? You can scale that idea up to days, weeks and months.

I see you suggested days, but what about an event that spans over two days?

I am not entirely sure that an OTP app here would work, but I am not an OTP expert by any stretch of anyone’s imagination. I’m open to being proven wrong here.

xlphs

xlphs

What if each future event is a process? To check for conflict, send a message to all events, those with conflict will report back, you can then cancel event that are not prioritized.

andre1sk

andre1sk

Postgres has range data types so it’s even simpler you can even build a unique index that will enforce no overlapping bookings

radar

radar

Nice :slight_smile: I wasn’t aware of this until now.

radar

radar

How far into the future would you be reasonably expected to check? What if there was an event the day after the last day you checked up to?

xlphs

xlphs

To infinity and beyond :smile: Recurring events will implement conflict check differently and only one process exists, one-off event is one process. I think this design makes sense if you want to do something fancy like weighted job scheduling which is a pretty classic problem.

DianaOlympos

DianaOlympos

My two cents :slight_smile:

Groups and registers ! Each event is an independant process. You register them to a group/register for the room. And when a new event come, you can just broadcast to all event asking for conflicts. They are optimisations that can be done, like also having a “leader” process per room that handle an aggregated copy of the data, etc etc.

I think @Trevoke is discovering that lately through his side project.

Trevoke

Trevoke

Haha, yeah, I am.

Having every event an independent process does offer significantly more freedom overall, although it does mean a change in perspective and tooling.

It turns out Google Calendar’s current interface can show you some reasonable approaches to it, by limiting the time range in which it will suggest times for the meeting: if you’re concerned about every event ever being a process, you can also just spawn the ones you’re likely to need.

As for me, I’m stuck with a failing test over here: (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews