jhass has quit [Remote host closed the connection]
jhass has joined #ruby
Guest2365 has quit [Quit: WeeChat 4.6.2]
grenierm has joined #ruby
schne1der has joined #ruby
cappy has joined #ruby
jmcantrell has quit [Ping timeout: 276 seconds]
llua has quit [Ping timeout: 260 seconds]
llua has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 276 seconds]
rvalue- is now known as rvalue
dionysus69 has joined #ruby
jhass has quit [Read error: Connection reset by peer]
jhass has joined #ruby
infinityfye has joined #ruby
grenierm55 has joined #ruby
grenierm has quit [Ping timeout: 240 seconds]
grenierm55 has quit [Ping timeout: 240 seconds]
<moo>
I am so confused. [1,2,3].bsearch{|x| x>=1} => 1 while [1,2,3].bsearch{|x| x==1} => nil ??
<leah2>
you cant bsearch with ==
<moo>
oh i thought it just looks for true/false there :3 thanks
<leah2>
it needs to be monotonic
<moo>
oh heh it seems Array-Array is still plenty fast and i should just do that
<leah2>
jus tuse find
<leah2>
or that
<moo>
at first i made arr.reject!{|x| !arr2.index(x).nil? } and that was probably the worst way to do it haha
<leah2>
hehe
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Ping timeout: 244 seconds]
szkl has joined #ruby
infinityfye has quit [Killed (NickServ (GHOST command used by infinityfye__!~infinityf@154.180.111.99))]
infinityfye__ has joined #ruby
infinityfye__ is now known as infinityfye
cappy has quit [Quit: Leaving]
GreenResponse has joined #ruby
andy-turner has quit [Quit: Leaving]
Linux_Kerio has joined #ruby
otisolsen70 has joined #ruby
Linux_Kerio has quit [Ping timeout: 260 seconds]
brokkoli_origin has quit [Ping timeout: 248 seconds]
brokkoli_origin has joined #ruby
inline has quit [Quit: Leaving]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
wbooze_ has joined #ruby
wbooze_ is now known as inline
mange has quit [Quit: Zzz...]
inline has quit [Ping timeout: 252 seconds]
wbooze has joined #ruby
wbooze_ has joined #ruby
wbooze is now known as Guest8788
wbooze_ is now known as inline
Guest8788 has quit [Ping timeout: 276 seconds]
<nakilon>
my coworker is misunderstanding the purpose of the methods/functions
<nakilon>
1. he roleplays the winrar and when sees a line of code that is repeating several times he hurries to define a method that will be one line long, saying "it's simplifying the code, because we had the same thing repeated in multiple places", so now instead of repeating some obvious code we are going to STILL REPEAT but not the obvious thing but his cryptic method name?
<nakilon>
and 2. even if the thing isn't repeated anywhere and is called only once and will be so for the whole 21st century in the codebase he anyway goes to define a method "because we define methods like this" ("we define" -- he means his own idea from the (1)
<nakilon>
in my 20 years of coding experience I know from long ago that many things that are hiding by different "pattern" names are often just the same thing, and the whole purpose of functions by the damn definition of the word is to DRY the things; functions are to move something to a single place only due to two reasons:
<nakilon>
a) the stuff may change and to not forget to edit some of the multiple places we put the changeable thingy into a constant (or single literal method, it all depends on the language syntax, etc.) to edit it in one place if it ever will be needed
<nakilon>
b) if the repeating thing is a multiline block; so it takes more lines to read and proportionally increases the chance to forget or miss some detail
<nakilon>
but he sees `get("user/documents")` and defines a user.documents and who the hell is gonna know what that means? is that a GET or POST? is that a REST at all?! maybe that's an attribute? he hides a place that unlike other lines of code is a network request, i.e. slow, error-prone, etc., saying it "makes code more readable" -- hell no, who knows what that method does? noone
<nakilon>
-- the DRY is not applicable here, it does not save us any lines, because it's being called only once and you just have hidden the implementation
<nakilon>
-- we should not reduce the number of lines, we should make the code readable
<nakilon>
dude, you literally have hidden the implementation -- how does it make it readable? you say "the REST api urls are named stupidly, my names are better" -- what? it is so subjective, the whole fact of thinking just renaming things is a needed thing
Sheilong has joined #ruby
<nakilon>
and no, we SHOULD reduce the number of lines, because the amount of errors is proportional to it; dude just does not know how to code, and it frustrates be, because the boss is gonna decide that the issue is in me because that's the best dude they possess to help me with the project; but defining layers of methods for a single call from another file is not a help
<nakilon>
*frustrates me
<nakilon>
idk how to make him accept my rules
<nakilon>
the `user.documents` is by no means "more readable" than `user.get("user/documents")`; it is just a lie; it is a result of some broken way to think
<kjetilho>
nakilon: if there is just one reference to it, fine. if there are multiple, `user.documents` can catch typos (`user.douments`) lexically but `get("user/douments")` can only be discovered during runtime
inline has quit [Quit: Leaving]
wbooze_ has joined #ruby
wbooze_ is now known as wbooze
wbooze is now known as inline
inline has quit [Client Quit]
wbooze_ has joined #ruby
wbooze_ is now known as wbooze
otisolsen70 has quit [Quit: Leaving]
dionysus69 has quit [Ping timeout: 276 seconds]
<nakilon>
kjetilho: nice point, though I doubt anyone in my company has a language server to detect typos; will Rubymine see it?
<nakilon>
and we have CI anyway, so the typo does not create a business-logic error and will be caught anyway
<nakilon>
I mean, in my opinion the code structure should help building programs with correct logic, not solve the issues that otherwise would be spotted if Ruby was compilable
wbooze has quit [Ping timeout: 245 seconds]
brokkoli_origin has quit [Ping timeout: 276 seconds]
brokkoli_origin has joined #ruby
wbooze has joined #ruby
sarna has quit [Ping timeout: 276 seconds]
jmcantrell has joined #ruby
sarna has joined #ruby
jmcantrell has quit [Ping timeout: 244 seconds]
<o0x1eef>
I'm not sure I think 'user.documents' is an anti-pattern tbh. I can see benefits with that approach. Still, if everything is a method it just adds a layer of indirection that can make code harder to follow, it depends how widespread it is
Everything has joined #ruby
michfx has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]