Ivan Lugo
05/04/2022, 3:53 AMwtaysom
05/06/2022, 1:04 AMIvan Lugo
05/06/2022, 1:06 AMwtaysom
05/06/2022, 1:07 AMIvan Lugo
05/06/2022, 1:13 AMDaniel Garcia
05/07/2022, 11:38 AMIvan Lugo
05/07/2022, 2:40 PMDaniel Garcia
05/07/2022, 3:37 PMIvan Lugo
05/07/2022, 3:40 PMwtaysom
05/08/2022, 4:27 AMIvan Lugo
05/08/2022, 5:25 AMDaniel Garcia
05/08/2022, 1:35 PMwtaysom
05/10/2022, 3:17 AMsimulation.tick(10);
to the bottom of the dragged
function to stiffen it up. (Press the little play button to commit the change.) Then you can even tell the centrality of a node with the edges turned off linkStrokeOpacity = 0.0
.Daniel Garcia
05/14/2022, 10:33 PMCode explorer
.
But I guess it could also be a tracer when I add live values to it (I hope not too far in the future 🤞).
@wtaysom will love to hear your comments, if you have some time to spare and watch this video https://futureofcoding.slack.com/archives/CCL5VVBAN/p1650855082164669?thread_ts=1650340488.796839&cid=CCL5VVBANwtaysom
05/16/2022, 3:23 AM<td class='number'><%= format_total_blocks_to_assign_per_assignment_area_across_encumbrance_levels %></td>
We have a helper clock_stage_results_helper.rb
because we need to insert slashes and commas between a bunch of numbers with "Block" or "Blocks" tagged on the end depending on plurality (and potentially language):
def format_total_blocks_to_assign_per_assignment_area_across_encumbrance_levels
_f_aa(&:total_blocks_to_assign_across_encumbrance_levels)
end
Now this private method _f_aa
is going to iterate across assignment areas defined in assignment_area.rb
calling total_blocks_to_assign_across_encumbrance_levels
for it:
def total_blocks_to_assign_across_encumbrance_levels
product_numbers.map do |pn|
weighted(@clock_stage_result.winnings(pn))
end
end
So then the main branch here goes through clock_stage_result.rb
basically looking up the @sold_package
. It's a ClockStageResult::Package basically a product number indexed collection, basically a cache, a summary of a calculation. This is as far as a call stack is going to get you, but it totally makes sense to ask where does the @sold_package
come from? What exactly is it summarizing about the clock stage?
In layered code like this, the idea of having some blocks to show is split across many files: files for adding the presentational details, files for gathering together the total from the parts, the parts themselves, and where those parts come from. It's all well organized. Everything has and is in its proper place. I can even press ^z to jump from one definition to next, but I don't automatically have what I need right on the screen, and we totally could have the editor do this though it's not trivial. Two challenges come to mind:
1. The lesser: in Ruby, it's not statically perfectly clear from the text how the references work. For my editor, "Goto Definition" generally works, is sometimes ambiguous, "Goto Reference" doesn't work. I do a full text find. It's not terrible, it just slows you down.
2. Much more important: an editor needs some smarts to know what related parts to open up. In an scenario like this, there is a main path to follow (view-to-model, whole-to-part), but a system needs to be smarter than just opening up every definition. Consider this one:
def total_blocks_to_assign_across_encumbrance_levels
product_numbers.map do |pn|
weighted(@clock_stage_result.winnings(pn))
end
end
Of the things referenced here product_numbers
, map
, pn
, weighted
, @clock_stage_result
, winnings
, how do you tell that winnings
likely has priority as the thing you want to inspect as opposed to map
, which is the least likely?Daniel Garcia
05/16/2022, 4:57 AMwtaysom
05/16/2022, 7:52 AMtotal_blocks_to_assign_across_encumbrance_levels
? Let's say we inline local methods, stack loops (only usually showing a single focused example iteration but with borders to suggest how many times the loop is called), and expand calls to other objects to the right. That would probably feel good.@clock_stage_result
set? Maybe "outline" data dependencies. I mean if I'm focused on total_blocks_to_assign_across_encumbrance_levels
I show the code where @clock_stage_result
gets set above the method. Since assignment is often written before use, it's likely to be higher up in the same file.