smedegaard
I’m pretty new to Elixir. I’ve read some books, done a Udemy course, done some exercism and hackerrank problems and started on a Phoenix app.
I was a happy camper, but following the Elixir buzz on this forum, Elixir Fountain and other places I started getting the feeling that the “1.2 way” of doing Phoenix apps was kinda frowned upon by some people.
So I stopped development on my Phoenix app and read a bit more about OTP, watched Chris presentation of Phoenix 1.3 a bunch of times, bought and started reading Lance’s new prag prog book and tried to apply those thoughts and ideas to my app.
Now i bassically feel like a poor noob that is getting told that
“You probably don’t need a database”
But I really can’t see how anything else but a live session kinda thing like a game or a chat could work without persisting data in a database.
Am I misunderstanding this totally? Are there any other poor noobs out there that are getting the same vibe?
Trending in Discussions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 40 to 31- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
AstonJ
@NobbZ’s post sums it up for me:
If it’s data you don’t mind losing in case of a system/power failure (such as temporary user settings) then there’s a good argument not to persist. But if it’s something like User account details, then I would persist.
Also, as you’re interested in application architecture I highly recommend PragDave’s online course - it’s sparked some really interesting discussions about approaches to development in Elixir.
yial2
I am reading the same book(functional-web-development-with-elixir-otp-and-phoenix) and this exactly what I am feeling like recently. Initially I was really excited because I feel like it can be a huge performance gain since there is no more back and forth between code/logic and database.
I also ask some questions regarding my specific need on elixir-lang IRC. The specific conversation can be found here beginning 4:06PM between users yial2(myself), @radar, and Zarathu. The preliminary is that GenServer process may not be suitable for my need, but I am still doing some more reading to try to find out more on my own.
smedegaard
Thanks!
cdegroot
Don’t forget,
Kernel.put_in/3is your friend when doing nested structs(and the only reason that I’m mentioning this is that I had a hard time finding it in the docs when I needed it…)
smedegaard
Thanks again.
That’s actually what I started doing yesterday. With one eye on “To spawn or not to spawn” and one eye on the Functional Web Dev book I began making modules with structs to represent my contexts/units. Let’s see where this leads
easco
I agree with you. There doesn’t really seem to be any reason to put those things into an Agent or process in-of-themselves. They could just as easily be crammed in a struct:
By the same token there’s not any particular reason to start out by tying them to a database. In the future, should you want to try some fancy stuff (say estimating Lovibond from the particular grains in the profile) you shouldn’t have to “contaminate” your estimation logic with a bunch of stuff related to database queries and the size of table columns.
smedegaard
I guess what I’m struggling with is see nice pure functions and modules for this use case.
My mind is in object ↔ Database land…
Take
malt_profile. It would have a name and some attributes like colour and such. I can’t imagine that cramming stuff like this in anAgentorProcesswould have any benefits.There’s no real time commutation going on. The only thing a malt would ever do is being a part of a
malt_profile. And that in turn, would only be part of arecipe, which would be part of abatch.No game dynamics. No chat. Nothing fancy (yet)
smedegaard
yeah. I agree. But I’m too much a noob to take all of this stuff in in one go…
Qqwy
I think the ‘contexts’ that Phoenix 1.3 is introducing are very much in line with the “create an interface for your app’s business domain and implement it for the persistence piece(s) you are considering.”, in that the context module is the only place where the business domain layer and the technical layer meet.
smedegaard
So I guess I’ll just post it here and see what happens…
Basically
usershaverecipesa
recipehave ayest_profile,malt_profile,mash_schedule,hop_profileandadjunctsa
batchwill have arecipe,brew_dateand other batch spekecific data pointsI’m thinking that there should be both public and private repositories for malts, yeasts and hops
I have some other features in mind, but let’s leave that out for now.
If I was to “go the Uncle Bob way” and leave persistence out of this for as long as possible, how would I do this?