# Plugin system in Elixir

**URL:** <https://forum.elixirforum.com/t/plugin-system-in-elixir/6791>\
**Category:** Questions\
**Tags:** architecture, how-to-question\
**Created:** [July 11, 2017, 11:41pm UTC](https://forum.elixirforum.com/t/plugin-system-in-elixir/6791 "2017-07-11T23:41:52Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![alexcastano](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/alexcastano/32/5861_2.png) [@alexcastano](https://forum.elixirforum.com/u/alexcastano)\
**Post date:** [July 12, 2017, 10:19am UTC](https://forum.elixirforum.com/t/plugin-system-in-elixir/6791/3 "2017-07-12T10:19:43Z")

</div>

Hello @aseigo, thank you for your response,

I wanted something a little bit more complex, I need more composition. This small example in Ruby maybe helps:

```ruby
class UploaderBase
  def upload(io, options)
    store.upload(io, options)
  end

  def delete(name)
    store.delete(name)
  end
end

class Plugin::Backup
  def upload(io, options)
    super
    backup_store.save(io, options)
  end

   def delete(name)
     super
     backup_store.delete(name)
  end
end

class Plugin::Validation
  def upload(io, options)
    if validate?(io, options)
      super
    end
  end
end

```

Then the user of the library do something like this:

```ruby

class MyImageUploader
  include UploaderBase

  plug :backup, store_backup: :s3
  plug :validation

  def validate?(io, options)
    io.size < 3.megas
  end 
end

```

So basically, I want to be able to use my parent behavior and only if need it, add more functions in plugins, etc. As far I understand, I cannot achieve this with behavior, only a simple polymorphism. The middleware I linked in my previous post may work, but do it for each function for each module seems too much.

And yes, I want to do it because I will need it in the future, but mostly to learn Elixir in a more realistic scenario.

Thank you for your links.

---

_[View the full topic](https://forum.elixirforum.com/t/plugin-system-in-elixir/6791)._
