All Projects → wojtekmach → Oop

wojtekmach / Oop

OOP in Elixir!

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Oop

Simuleios
Simulations for LeiosOS
Stars: ✭ 174 (-25.32%)
Mutual labels:  fun
Sudo Productivity
Boost your "productivity" to the max! A fun project made for slackers by slackers.
Stars: ✭ 190 (-18.45%)
Mutual labels:  fun
Learning Oop In Php
A collection of resources to learn object-oriented programming and related concepts for PHP developers.
Stars: ✭ 2,359 (+912.45%)
Mutual labels:  oop
Unifiedtransform
A school management Software
Stars: ✭ 2,248 (+864.81%)
Mutual labels:  oop
Red Discordbot
A multi-function Discord bot
Stars: ✭ 2,855 (+1125.32%)
Mutual labels:  fun
Pencil.js
✏️ Nice modular interactive 2D drawing library
Stars: ✭ 204 (-12.45%)
Mutual labels:  oop
You Don T Know Oop
Знаете ли вы ооп?
Stars: ✭ 170 (-27.04%)
Mutual labels:  oop
Logtalk3
Logtalk - declarative object-oriented logic programming language
Stars: ✭ 221 (-5.15%)
Mutual labels:  oop
Libmoji
📚 Bitmoji's API made easy for everyone
Stars: ✭ 189 (-18.88%)
Mutual labels:  fun
Bliss
Blissful JavaScript
Stars: ✭ 2,352 (+909.44%)
Mutual labels:  oop
Object Oriented Programming Using Python
Python is a multi-paradigm programming language. Meaning, it supports different programming approach. One of the popular approach to solve a programming problem is by creating objects. This is known as Object-Oriented Programming (OOP).
Stars: ✭ 183 (-21.46%)
Mutual labels:  oop
Interview Questions
List of all the Interview questions practiced from online resources and books
Stars: ✭ 187 (-19.74%)
Mutual labels:  oop
Memetastic
Meme Creator for Android - Simple & Ad-Free
Stars: ✭ 206 (-11.59%)
Mutual labels:  fun
Software Engineer Interview Questions
A lot of questions and links to prepare yourself for an interview.
Stars: ✭ 176 (-24.46%)
Mutual labels:  oop
Floating.js
Float a number of things up on a page (hearts, flowers, emojis, words ...)
Stars: ✭ 209 (-10.3%)
Mutual labels:  fun
Tinykaboom
A brief computer graphics / rendering course
Stars: ✭ 2,077 (+791.42%)
Mutual labels:  fun
Python Raytracer
A basic Ray Tracer that exploits numpy arrays and functions to work fast.
Stars: ✭ 204 (-12.45%)
Mutual labels:  fun
Crystal Patterns
📖 Examples of GOF patterns written in Crystal
Stars: ✭ 228 (-2.15%)
Mutual labels:  oop
Aquila
🎨 An Advanced WordPress theme
Stars: ✭ 204 (-12.45%)
Mutual labels:  oop
Testdeck
Object oriented testing
Stars: ✭ 206 (-11.59%)
Mutual labels:  oop


oop

OOP

Build Status

Are you tired of all of that modules, processes and functions nonsense? Do you want to just use classes, objects and methods? If so, use OOP [1] library in Elixir [2]!

[1] Actually, according to Alan Key, the inventor of OOP, "objects" is the lesser idea; the big idea is "messaging". In that sense, I can't agree more with Joe Armstrong's quote that Erlang is "possibly the only object-oriented language".

[2] Please don't. You've been warned.

Demo

Lightning Talks - Wojtek Mach (ElixirConfEU 2016)

Example

import OOP

class Person do
  var :name

  def say_hello_to(who) do
    what = "Hello #{who.name}"
    IO.puts("#{this.name}: #{what}")
  end
end

joe = Person.new(name: "Joe")
mike = Person.new(name: "Mike")
robert = Person.new(name: "Robert")

joe.say_hello_to(mike)    # Joe: Hello Mike
mike.say_hello_to(joe)    # Mike: Hello Joe
mike.say_hello_to(robert) # Mike: Hello Robert
robert.say_hello_to(mike) # Robert: Hello Mike

joe.set_name("Hipster Joe")
joe.name # => Hipster Joe

An OOP library wouldn't be complete without inheritance:

class Animal do
  var :name
end

class Dog < Animal do
  var :breed
end

snuffles = Dog.new(name: "Snuffles", breed: "Shih Tzu")
snuffles.name # => "Snuffles"
snuffles.breed # => "Shih Tzu"

... or multiple inheritance:

class Human do
  var :name
end

class Horse do
  var :horseshoes_on?
end

class Centaur < [Human, Horse] do
end

john = Centaur.new(name: "John", horseshoes_on?: true)
john.name # => "John"
john.horseshoes_on? # => true

See more usage in the test suite.

Installation

  1. Add oop to your list of dependencies in mix.exs:
def deps do
  [{:oop, "~> 0.1.0"}]
end
  1. Ensure oop is started before your application:
def application do
  [applications: [:oop]]
end

License

The MIT License (MIT)

Copyright (c) 2015 Wojciech Mach

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].