Developing Development Terminology
While at Flatiron School, we have come across a few situations when we need to use a certain syntax and we are given the rules and symbols but there is no set vocabulary on how to define those symbols. This led to a certain ambiguity and creativity in naming specific Ruby symbols while communicating with group mates and instructors. This post will be gradually growing as we come across more and more examples.
#
I know, you may think that I’m joking — of course, it is a ‘hashtag’ or ‘hash’. But the proper dictionary definition of the #
symbol is octothorpe.
array[array.length — 1];
computed member access operator.
<% %>
and <%= %>
Set of tags used to enclose Ruby code in Embedded Ruby (ERB) files in the view of our app. Well, our instructors called them simply erb tags. Other variants exits such as:
expression-printing tags for (
<%= %>
) andnon-printing tags for (
<% %>
)
Official Ruby on Rails documentation on ActionView call them as
regular embedding tags (
<% %>
) andoutput embedding tags (
<%= %>
)
_menu.html.erb
How would you call “ _ ” in the above file name? The right answer is:
the leading underscore (
_menu.html.erb
)
For instance, the leading underscore is used to name partials in Rail’s ActionView to distinguish them from regular views.
memoization
An optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again.
Example of a generic memoize()
function:
function memoize(fn) {
// declare an object to store our calls to a slower fn
const cache = {};
// create an anonymous fn that is able to recieve multiple arguments
return function(...args) {
if (cache[args]) {
return cache[args];
}
// get the result of the original slow fn and store it in cache
const result = fn.apply(this, args);
cache[args] = result;return result;
};
}
… to be continued