Decomposing domain models based on lifecycles

How can you decompose big domain models into nice modular design? I wrote a blog post (with examples in Elixir!) describing one of the possible techniques.

https://mkaszubowski.com/2020/06/24/decomposing-models-lifecycle.html

Step by Step Guide to Improving Cohesion in Elixir

I had the pleasure of using Elixir on a recent project. So I wrote an article on a helpful technique that I used to increase the Cohesion of my code. Please check it out! https://soonernotfaster.com/posts/step-by-step-guide-to-improving-cohesion-in-elixir/

How to migrate live production data

Migrating live data is risky. Let’s analyze how to do that safely.

https://patrykbak.com/2020/05/28/how-to-migrate-live-production-data.html

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

Phoenix LiveView and PubSub

In this episode of ElixirCasts we’ll send events from a Phoenix LiveView JS Hook and broadcast them using Phoenix PubSub to update all subscribed clients in real-time.

https://elixircasts.io/phoenix-liveview-and-pubsub

Best Practices for Background Jobs in Elixir

Learn how to avoid some common mistakes while working with background jobs in Elixir.

https://blog.appsignal.com/2020/06/24/best-practices-for-background-jobs-in-elixir.html

Introducing Lean Server, HTTP Server in Gleam

http://crowdhailer.me/2020-06-23/introducing-lean-server-for-midas/

Explanation of why I built, another, webserver. As well as the goals of this new server in Gleam.

Adding pagination with live_patch for my site using Dissolver

https://morphic.pro/posts/how-i-added-pagination-using-live-patch-for-my-liveview-site-using-dissolver

In this blog post, I show a lib that I’m currently developing called Dissolver.

https://github.com/MorphicPro/dissolver/

Dissolver is a fork of Kerosene which is an Offset based paginator and in this post, I show how I use it along with a custom theme to integrate with LiveView and live_patch.

In addition, I show how you can use Dissolver to build out Ecto Queries so that you can paginate on a preload association like for example a tag of a post.

Simple Phoenix LiveView App: The Podcast Listing Page

Part 11 of the Simple Phoenix LiveView App series

This episode is just a quick refactor and restyling of the podcast listing page. It creates show note excerpts for it, play buttons for the audio and removes a lot of unneeded clutter.

https://alchemist.camp/episodes/phoenix-podcast-index-styling

5 top-tier companies that use Elixir

What connects Pepsi, Spotify, and Discord? They all use Elixir in their tech stack. Learn why in Curiosum latest article - 5 top-tier companies that use Elixir

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

Incident 0.4.1 released for Event Sourcing and CQRS

Just published Incident version 0.4.1 for Event Sourcing and CQRS, check it out https://hex.pm/packages/incident #myelixirstatus

Implementing a custom ExUnit assert to test PDF output

I went on and implemented my custom ExUnit assert to visually vet PDF output.

Simple Phoenix LiveView App: Markdown show notes

Part 10 of the Simple Phoenix LiveView App series

It covers setting up an enhanced version of Markdown for editing show notes, and sanitize user-entered content.

https://alchemist.camp/episodes/phoenix-markdown-show-notes

Announced the Domo library's first release during the lightning talk at the ElixirConf EU Virtual

The library is to model a business domain with type-safe structs and composable tagged tuples.

Now a new valid way to have type-safe structs at the runtime is available:

defmodule Order do
  use Domo

  typedstruct do
    field :id, integer
    field :item, String.t(), default: "mixed fruits"
    field :quantity, float
  end

  # the new!/1 constructor function is generated automatically
end
iex(1)> Order.new!(id: "twenty one", quantity: 20)
** (ArgumentError) Can't construct %Order{...} with new!([id: "twenty one", quantity: 20])
    Unexpected value type for the field :id. The value "twenty one" doesn't match the integer type.
    Unexpected value type for the field :quantity. The value 20 doesn't match the float type.

iex(2)> Order.new!(%{id: 125, item: "banana", quantity: 20.5})      
%Order{id: 125, item: "banana", quantity: 20.5}

It was awesome!

https://hex.pm/packages/domo

https://github.com/IvanRublev/Domo

Please, give it a try, and star on the GitHub if you like it or hate it 😀

How to use Elixir LS with Vim

I’ve updated my article “How to use Elixir LS with Vim” to reflect the recent updates to Elixir LS and ALE.

https://www.mitchellhanberg.com/post/2018/10/18/how-to-use-elixir-ls-with-vim/

The beauty of recursion and pattern matching in functional programming languages

…or how to write full-featured functions with ZERO INSTRUCTIONS about HOW it should work!

https://dev.to/ericdouglas/the-beauty-of-recursion-and-pattern-matching-in-functional-programming-languages-hmn

Elixir Wizards S4E5 Dave Thomas on Learning How Things Work

Latest episode of Elixir Wizards is out today! Check it out here: https://smartlogic.io/podcast/elixir-wizards/s4e5-thomas/

Create mocks of erlang modules with elixir_mock v0.2.9

Version 0.2.9 of the elixir_mock library now allows you to create mocks from erlang modules like :erlang and :inet.

test "should create simple mocks from erlang modules" do
    mock = mock_of :erlang
    assert mock.self() == nil
end

test "should create custom mocks from erlang modules" do
    with_mock(mock) = defmock_of :inet do
      def ip(_), do: :fake_ip
    end
    assert mock.ip(nil) == :fake_ip
end

`Blocked` released! Keep track of when hotfixes can be removed

Blocked is an Elixir-library that helps you to keep track of when hotfixes can be removed by showing compile-time warnings when issues (in your project repository or any other source-code GitHub repository) are closed.

hex.pm versionBuild StatusDocumentation


Blocked was made to improve the quality of your project’s code over time: It automates away the human task of checking whether certain hot-fixes, ‘temporary patches’ or ‘duct-tape code’ are still required. This makes it less scary to add a temporary workaround to your codebase, because you’ll know the minute it is no longer necessary!

Basic features:

  • Runs at compile-time as a macro.
  • Prints a compile-time warning any time an issue is closed that a piece of your code was waiting for.
  • Works for your own project issues as well as for issues of any other GitHub-hosted repository.
  • Allows specifying both ‘hotfix’ and optionally a ‘desired’ code block, to make it clear to future readers of your code what can be changed once the related issue is closed.
  • Configurable to work on private repositories as well.
  • By default performs only checking in Continuous Integration, to keep local compilation fast.

Simple usage example

defmodule Example do
  require Blocked

  def main do
    IO.puts("Hello, world!")
    Blocked.by("#42", "This code can be removed when the issue is closed") do
      hacky_workaround()
    end
    
    # The reason is optional
    Blocked.by("#69") do
      a_quick_fix()
    end
    
    # It is possible to indicate
    # the desired 'ideal' code as well, by passing an `else` block:
    Blocked.by("#1337") do
      ugly_fallback()
    else
      beautiful_progress()
    end
    
    # If the blockage is more general, you can also leave out the `do` block.
    Blocked.by("#65535", "This whole module can be rewritten once we're on the new Elixir version!")
    
    # Blocked supports many ways of referring to an issue
    Blocked.by("#13")
    Blocked.by("elixir#13")
    Blocked.by("elixir/13")
    Blocked.by("elixir-lang/elixir#13")
    Blocked.by("elixir-lang/elixir/13")
    Blocked.by("https://github.com/elixir-lang/elixir/issues/13")
  end
end

Find it on GitHub and talk about it on the Elixir Forum! :-)

ThinkingElixir 001: News and Meet the Hosts

First episode of the Thinking Elixir Podcast! We cover recent community news and introduce the hosts. We discuss pattern matching, immutability, supervision trees, and concurrency as things that captured our attention when coming to Elixir. Mark Ericksen was a long time host of the Elixir Mix podcast and launched a new show. Check it out!

Podcast Episode

Correios CEP 0.6.0 released! Remove zipcode field and update HTTPoison.

Correios CEP allows to find Brazilian addresses by postal code, directly from Correios API. No HTML parsers.

DEPRECATION NOTE

Correios.CEP.Address.zipcode was removed in the version 0.6.0. Use Correios.CEP.Address.postal_code instead.

Changelog for version 0.6.0:

Changed

  • Update HTTPoison to 1.17.0 (hackeny 1.16.0)

Deprecated

  • The field zipcode in Correios.CEP.Address. Use the field postal_code instead.

Removed

  • Support for OTP 20.

Check it out at: