1,181 karma · joined February 6, 2013
Pre commit hook: https://github.com/jasongoodwin/elixir-mix-format-pre-commit...
Emacs format current file: https://github.com/jasongoodwin/emacs-elixir-formatter
Generally the formatter is good, but we've noticed a couple cases where it would be nice to override
EG:
it would be nice to have the join and on statements on the same line so you can see as the reader what relates to what
u in Db.User,
distinct: u.id,
join: c in Db.Comment,
on: u.id == c.user_id,
join: p in Db.Profile,
on: u.profile_id == u.id,
join: x in Db.SomethingElse,
on: x.profile_id == u.id,
join: y in Db.AnotherThing,
on: y.profile_id == u.id,
...I can see why it's like that, but it would be nice to be able to override it.
Also the formatter requires () so you end up with ecto code differing from the styles recommend in the docs
schema "thingy" do
field(:name, :string)
field(:abbreviation, :string)
end
instead of schema "thingy" do
field :name, :string
field :abbreviation, :string
end
Anyway, still useful and good for the team.If I need to be working from home I like to use pomodoro to keep me on task. Having a clear list of tasks is good. Taking notes in org-mode on the activities that I'm working on is also good. Basically anything that I would normally do to deal with complexity I need to do when I'm working at home or I end up wasting swathes of time unless I'm really well slept and on point (which I'm usually not because I work at a tiny startup)
Something like eg Google Spanner relies on atomic clocks - it's a combination of hardware and software that enable the use of wallclock time.
Personally, I find these patterns and approaches coupled with sound domain modelling to be perfectly fine. There is some technical overhead for event sourcing so some places we do not use a journal but instead persist current state but we still emit events and do interesting things with those events. CQRS is pretty safe if you're investing into event driven architecture across your organization. You don't need to use both - one or the other is okay too.
I wouldn't have designed this system any other way - there are so many opportunities to do interesting things with the event stream that we discover almost daily.
Event sourcing is more dangerous and you need to have some really sharp people around to fix issues that come up and make it hum. We have multi-million line logs and I've had to spend some time going through open source libraries and changing implementations for projections from the log that were creating contention and performance issues, as well as modifying how the open source libraries recover to paginate through the events. All in, we can now recover from json in postgres at a rate of 20k events/s (although usually we recover from snapshot!) and we can tear through thousands of commands a second in the running system. After these hurdles, everything is contant time or logarithmic so we can handle orders of magnitude growth without any issue. One day we'll have to flip our aggregates to have a clean journal. It's just life in engineering though - software isn't an event, it's a process so if you want to get the gains sometimes there are some costs. As long as you are smart about your choices and have a good team, you can make anything work.
I'll add that the existing stack uses ORMs/active record and the performance overhead of all those damn queries is now too expensive so we're building some screaming fast Eventsourced and commandsourced apps SPECIFICALLY TO GET AWAY FROM THOSE TRIED AND TESTED CLASSICAL PATTERNS. Mind you, we could make the existing application hum too with some careful analysis - I'm not saying one is better or worse, just that they are both equally viable with some smart minds around and good decisions being made. DDD is never a bad thing and ES/CQRS happen to be a reallly incredible fit in spaces where the domain is central as you end up very easily discovering you can have pure and beautiful domain models when you think in commands and events.
I'll just leave a caveat that, while I think we're having good success with the decisions, we also work in a domain with enough complexity that we get a lot of benefit in how ES acts as a heuristic in our modelling. Doing the same with a shopping cart may be overkill.