« first day (963 days earlier)      last day (2292 days later) » 

 
2 hours later…
 
3 hours later…
10:53 AM
Is there any way to learn how to work on code as a group without actually working with anyone else? I've learned git, but I can't think of anything else.
 
11:48 AM
@thesecretmaster That... really makes no sense
 
12:05 PM
As in my question is confusing or my question contridicts itself?
 
It's self-contradictory
It's like asking if you can learn to sing in a choir without other people
 
But you could learn specific techniques to use when you are in a choir without actually being part of one.
 
12:52 PM
Most of what you need to know when working with others isn't technical--it's social. It's conflict resolution, listening, give-and-take.
 
1:17 PM
good morning, fine people
 
I was just trying to learn minitest from a tutorial online and I promptly realized that I was doing TDD totally wrong. Is there anyway to write good tests for already written code?
 
Yes. One way is to comment out all the code, then start writing tests that make you comment it back in, a bit at a time.
That's not really TDD, because you're not letting the tests drive the design of the code, but it works.
@Kneel-Before-ZOD Good morning, fine person.
 
1:33 PM
Anyone want to help me close this old question of mine? It's clearly caused by a typographical error.
 
1:53 PM
anyone in here worked on a frontend application such as Angularjs or ReactJS?
 
2:15 PM
I've done a little React
 
2:38 PM
I'm trying to understand how the frontend and backend are deployed.....i.e. developed & deployed as a single entity or as separate services? @meagar
the last project I worked on, they were bundled together (but that was with BackboneJS)
 
2:56 PM
@thesecretmaster Do you get some kind of a martyrdom badge for flagging your own question?
 
I dunno, but it's a bad question, so I want to close it
 
I didn't mean to imply that you did it for a badge... just curious if doing the right thing gets you a bauble of some kind.
 
bauble, bauble, toils and trouble..
 
compiler burn and interpreter bubble
 
3:16 PM
@Kneel-Before-ZOD We built both projects completely separately and deploy them separately
The React stuff is just thrown up on some static server some place, basically dead simple static file hosting
 
does the requests between the frontend and backend pass through a webserver?
 
Well, yeah, there is an nginex instance serving static files
 
@Kneel-Before-ZOD yes
 
The client then talks to a Rails-backed API server to get its data
Basically client connects to example.com and gets html/javascript/css but no data, then the client-side React app boots and talks to api.example.com to fetch the data it needs to show stuff
 
 
1 hour later…
4:32 PM
@meagar thanks.....I understood the flow; I just haven't seen the separation into separate projects/deployment before and thought that's weird. Learned something new
 
@meagar I wish you wrote more of the tutorials I've read. Those two sentences are beautifully succinct and descriptive.
 
Thanks :p
 
Sanity check, is it possible to have a rails form where the input has both select options and a text option for the same param item
or am I wasting time with my search
 
what do you mean? @Btuman
one would override the other..
 
I mean that there could be a list of selectable options and the ability to type in a text option if the desired option is not there
overriding would be fine, if you mean what I think you mean
 
4:41 PM
you have to write custom javascript to ensure the correct data is being sent. my suggestion is to have a hidden input with the param name you want. the write some javascript to fill the hidden input with the correct value @Btuman
 
hmm, is that simplest way to approach it?
 
you can also write the logic in the backend
 
and still have basic rails form helpers on the view?
 
so put both elements in the form, in the rails controller action check for the params
 
and use the same param name?
 
4:43 PM
nope obviously different ones
that way you will have both values but then in the backend you can grab the non empty value
 
ah I see what you are saying
kk thanks
 
hope it helps :)
it depends on your application, i have done both ways
 
 
3 hours later…
8:07 PM
Sometimes my brain wants to call code "unnecessary" when it isn't. I just had this argument with myself over this code:
  def delete_rows(temp_ids)
    ...
    rows_deleted = SqlServer.exec_sql(sql)
    rows_deleted
  end
This could be written as:
  def delete_rows(temp_ids)
    ...
    SqlServer.exec_sql(sql)
  end
And the code would do the same thing, but without telling the reader that the return value of SqlServer.exec_sql was in turn the return value of this function, or what that return value meant.
The more verbose, explicit code won the argument.
 
Yeah, this is a problem, and something I really don't like about Ruby
 
Couldnt you also say that it return rows deleted in your docs?
 
Actually, this is a problem with the method, I think. It has side-effects and a return value.
@thesecretmaster I could. I like the code to speak for itself, when it can.
 
@thesecretmaster Then you have to keep the documentation in sync with the code
 
8:37 PM
> If the code and the comments disagree, both are probably wrong. -- Norm Schryer
@meagar In what ways does this problem get solved in other languages?
 
@WayneConrad less implicit, more explicit
Even in PHP or JavaScript for example, a method doesn't return a value unless you find a return in it
It's a pretty common problem in Ruby to accidentally modify a method's return value because you didn't realize it was supposed to return something
 
Having return be explicit does help, but the temp variable can still be needed even then. because return SqlServer.exec_sql(sql) still doesn't say what is being returned.
By the way, I've refactored that method so it has only side-effects and no return value. Problem solved.
 
9:12 PM
@WayneConrad im confused.. ruby developers are suppose to know the last thing from the method is returned.. as for clarity, your method name is pretty clear on what it does..
 
It's about intent: Does the method's return value mean something, or is it junk that should be ignored?
 
im guessing you are saying we know the method returns whatever SqlServer returns, but we dont know what SqlServer returns ..
right?
 
Correct.
 
right
 
One way of solving the problem is to follow the convention that methods with side-effects are named after verbs; these methods have no meaningful return value. Methods without side-effects are named after nouns; these methods return something. Then the method name tells you whether the method has a meaningful return value or not (and what that return value means).
 
9:15 PM
i think rails docs do this kinda of thing in method comments
example:

# If the first argument is not a Symbol, then it will simply be returned:
      #
      #   ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
      #   # => returns MyOwnCacheStore.new
      def lookup_store(*store_option)
 
That's another way to do it.
 
oh i like that convention .. noun vs verbs
interesting that we just kind of follow it intuitively
def rows .. vs def update_rows
 
It goes way way back to Bertrand Meyer, the inventor of the Eiffel language. Smart guy.
7
Q: Origin of "a method should return a value or have side-effects, but not both"

Wayne ConradI read once that a method should either have a return value (and be referentially transparent), or have side-effect(s), but not both. I cannot find any references to this rule, but want to learn more about it. What is the origin of this advice? Out of what person or community did it arise? Ex...

Let me clarify that. He came up with CQS. I don't know that he came up with the noun/verb convention, but I wouldn't be surprised.
 

« first day (963 days earlier)      last day (2292 days later) »