These are chat archives for dry-rb/chat

22nd
Sep 2015
Benjamin Klotz
@tak1n
Sep 22 2015 10:55
a short hello to the driest community on earth :D
Andy Holland
@AMHOL
Sep 22 2015 10:55
:joy: Hi @tak1n :)
Luca Guidi
@jodosha
Sep 22 2015 10:56
Hey @tak1n :D
Benjamin Klotz
@tak1n
Sep 22 2015 10:56
curious whats going on in here :D :D
Andy Holland
@AMHOL
Sep 22 2015 10:57
We've been building micro-libraries to try and encapsulate common use-cases in Ruby that can be reused regardless of your existing toolset
Trying to promote DI, IoC, immutability and all of the things that are good in the world :p
Benjamin Klotz
@tak1n
Sep 22 2015 10:59
sounds pretty good :)
Piotr Solnica
@solnic
Sep 22 2015 10:59
hey @tak1n
Benjamin Klotz
@tak1n
Sep 22 2015 10:59
hey piotr, how are u doing?
Piotr Solnica
@solnic
Sep 22 2015 10:59
…and I just pushed https://github.com/dryrb/dry-data
Benjamin Klotz
@tak1n
Sep 22 2015 10:59
I got to this chatroom through this :P
im stalking u on github
:D
Piotr Solnica
@solnic
Sep 22 2015 11:00
@tak1n I’m good although in major ruby crisis mood right now :joy:
Benjamin Klotz
@tak1n
Sep 22 2015 11:00
yea saw some tweets about elixir from u
Andy Holland
@AMHOL
Sep 22 2015 11:00
Also, dry libraries should only infect the global namespace with a single constant (Dry) and, like ROM and roda, be kind to the runtime environment
Benjamin Klotz
@tak1n
Sep 22 2015 11:00
so not only stalking on github hehe :D
awesome philosophy
Andy Holland
@AMHOL
Sep 22 2015 11:01
:)
Piotr Solnica
@solnic
Sep 22 2015 11:01
we also want to explain that Dry doesn’t mean avoiding having to write ”foo” twice in your code
Andy Holland
@AMHOL
Sep 22 2015 11:01
And that :p
Benjamin Klotz
@tak1n
Sep 22 2015 11:01
I prefer to be more explicit than having some dark magic going on :P
Andy Holland
@AMHOL
Sep 22 2015 11:02
Yeah, I think using DI allows for that, and offers you more flexibility that The Ruby Way
Benjamin Klotz
@tak1n
Sep 22 2015 11:04
yea comming from Symfony2 I was pretty comfortable with this: http://symfony.com/doc/current/book/service_container.html
and had a hard time at the beginning
in rails
Piotr Solnica
@solnic
Sep 22 2015 11:04
@tak1n DI simplifies your code
it’s not magic, it’s super explicit
Benjamin Klotz
@tak1n
Sep 22 2015 11:05
@solnic I was not arguing against it, I stated my preference for it :D
Piotr Solnica
@solnic
Sep 22 2015 11:05
ah gotcha
Benjamin Klotz
@tak1n
Sep 22 2015 11:05
and arguing against black magic (active support cough cough)
:)
Andy Holland
@AMHOL
Sep 22 2015 11:06
:laughing:
@tak1n I never used Symfony, but I have used Laravel a fair bit
Benjamin Klotz
@tak1n
Sep 22 2015 11:07
Laravel reminds me too much of rails just in php land
so never tried it
Andy Holland
@AMHOL
Sep 22 2015 11:07
Yeah, it is a bit Railsy, but there's some good stuff in there too
Benjamin Klotz
@tak1n
Sep 22 2015 11:08
okay, left php land 1 year ago and was forced to learn rails to get a ruby gig
sad story :D
Andy Holland
@AMHOL
Sep 22 2015 11:09
And the community around it is good too, as it's PHP you can't do the same kind of magic that you can in Ruby so DI, IoC and Repositories and such practices are encouraged, otherwise testing would be a nightmare
Piotr Solnica
@solnic
Sep 22 2015 11:09
I know stories sadder than that but I feel you ;)
Benjamin Klotz
@tak1n
Sep 22 2015 11:58
@AMHOL thats true
@solnic hehe ok :D
Andy Holland
@AMHOL
Sep 22 2015 12:37
@solnic dry-data looks like it's coming along nicely :)
Just curious as to the use-case that sparked it?
Piotr Solnica
@solnic
Sep 22 2015 12:38
@AMHOL 8+ years of type-safety-related bugs
Andy Holland
@AMHOL
Sep 22 2015 12:38
:laughing:
Piotr Solnica
@solnic
Sep 22 2015 12:42
@AMHOL it should help in catching bugs earlier and when you didn’t, debugging should be nicer
as you’ll see “my Foo type failed to construct because input is wrong"
Andy Holland
@AMHOL
Sep 22 2015 12:43
Nice
Piotr Solnica
@solnic
Sep 22 2015 12:43
vs “undefined method “foobar” on nil” or mysterious “failed to coerce string to integer” etc
Andy Holland
@AMHOL
Sep 22 2015 12:43
I was thinking more like which libraries you intended to use it in? (Like could it be a candidate to replace ROM::Struct in Repo?)
Hannes Nevalainen
@kwando
Sep 22 2015 12:43
<3
Piotr Solnica
@solnic
Sep 22 2015 12:44
I also have high hopes that testing will be simpler once you have clean domain data type layer sporting equality methods
@AMHOL no, it won’t replace struct, but it will be used along with them
ROM blindly maps data to structs but it’s your job to define your value boundaries…here comes dry-data
Andy Holland
@AMHOL
Sep 22 2015 12:45
Cool, coercion is something I am missing in rom-repo
Andy Holland
@AMHOL
Sep 22 2015 15:32
https://twitter.com/beanieboi/status/646307001195200512 is the best thing I've seen in ages :joy:
Luca Guidi
@jodosha
Sep 22 2015 15:32
:cry:
Andy Holland
@AMHOL
Sep 22 2015 15:35
String#red, String#green and String#colorize, this is the epitome of why Rails best practices are Rubys worst practices
Luca Guidi
@jodosha
Sep 22 2015 15:36
@AMHOL Which gem defines these methods?
Andy Holland
@AMHOL
Sep 22 2015 15:38
Looks like colored, from reading railsbp/rails_best_practices#256
Piotr Solnica
@solnic
Sep 22 2015 15:38
@AMHOL I didn't
Andrew Kozin
@nepalez
Sep 22 2015 15:38
Ruby is missing a feature that randomly switches between those implementations
Andy Holland
@AMHOL
Sep 22 2015 15:38
:laughing:
Luca Guidi
@jodosha
Sep 22 2015 15:39
@nepalez :joy_cat:
Andy Holland
@AMHOL
Sep 22 2015 15:39
Pretty decent talk IMO
Piotr Solnica
@solnic
Sep 22 2015 15:39
@AMHOL re coercions, in rom-http, we need a way to specify resource schema along with types for coercions, I wouldn’t put it in mappers
as in, not in higher-level mapper layer
Andy Holland
@AMHOL
Sep 22 2015 15:42
That's an excellent point
I wish my brain worked like yours :laughing:
I completely failed to see that we want coercion regardless of whether we map to stucts, models or whatever else
https://github.com/fazibear/colorize I think Github should follow in Facebooks footsteps and add the equivalent of a "Dislike button"
Luca Guidi
@jodosha
Sep 22 2015 15:48
String.colors OMG
Andy Holland
@AMHOL
Sep 22 2015 15:49
:joy:
Piotr Solnica
@solnic
Sep 22 2015 16:09
@AMHOL you don’t, trust me :joy:
(re my brain)
@AMHOL in rom-sql you have a) db schema with column names and types b) a driver that loads data and handles lower-level coercions (good ones do that in C ext, so it’s fast) and finally c) sequel code loading coerced tuples into hashes
with rom-http you don’t those, so you gotta provide that
...to make things sane
Andy Holland
@AMHOL
Sep 22 2015 16:11
Is that with the rom header stuff?
WRT the schema?
Piotr Solnica
@solnic
Sep 22 2015 16:12
yes, more or less, we had a schema concept but I removed it, we can introduce it in a better way, hopefully it could be reusable across adapters that need it
oops, just realized that’s not rom-rb chat :joy:
Andy Holland
@AMHOL
Sep 22 2015 16:13
:p
Piotr Solnica
@solnic
Sep 22 2015 16:13
much chats, such confusion, wow
Piotr Solnica
@solnic
Sep 22 2015 16:20
Comparison:
            dry-data:   383813.7 i/s
              virtus:    36612.4 i/s - 10.48x slower
I’m going to count that as a win
Andy Holland
@AMHOL
Sep 22 2015 16:20
w00t
Luca Guidi
@jodosha
Sep 22 2015 16:39
Speaking of speed, did anyone played with Rust as native ext for Ruby?
Piotr Solnica
@solnic
Sep 22 2015 16:39
no, but yehuda showed a rust ext that was 100000x shorter than its C equaivalent and few times faster at BaRuCo this year
so that is something I need to look into for sure
ie port transproc functions to rust
and have rom 10 x faster than AR rather than “just” 2 x :joy:
Andy Holland
@AMHOL
Sep 22 2015 16:42
:joy:
Piotr Solnica
@solnic
Sep 22 2015 16:44
Calculating -------------------------------------
              virtus     3.466k i/100ms
     fast_attributes    31.380k i/100ms
              attrio     6.127k i/100ms
            dry-data    30.888k i/100ms
-------------------------------------------------
              virtus     36.223k (± 3.6%) i/s -    183.698k
     fast_attributes    386.340k (± 3.0%) i/s -      1.946M
              attrio     62.879k (± 5.6%) i/s -    318.604k
            dry-data    390.033k (± 5.7%) i/s -      1.946M

Comparison:
            dry-data:   390032.7 i/s
     fast_attributes:   386339.9 i/s - 1.01x slower
              attrio:    62878.6 i/s - 6.20x slower
              virtus:    36222.8 i/s - 10.77x slower
Hannes Nevalainen
@kwando
Sep 22 2015 19:02
much excite :clap: