- Jun 2023
-
stackoverflow.com stackoverflow.com
-
Using a property or a method to access the field enables you to maintain encapsulation, and fulfill the contract of the declaring class.
-
Exposing properties gives you a way to hide the implementation. It also allows you to change the implementation without changing the code that uses it (e.g. if you decide to change the way data are stored in the class)
-
- Jan 2023
-
rhodesmill.org rhodesmill.org
-
-
Hints for Preparing Documents Most documents go through several versions (always more than you expected) before they are finally finished. Accordingly, you should do whatever possible to make the job of changing them easy. First, when you do the purely mechanical operations of typing, type so subsequent editing will be easy. Start each sentence on a new line. Make lines short, and break lines at natural places, such as after commas and semicolons, rather than randomly. Since most people change documents by rewriting phrases and adding, deleting and rearranging sentences, these precautions simplify any editing you have to do later. — Brian W. Kernighan, 1974
—Brian W. Kernighan, 1974 “UNIX for Beginners” [PDF] as Bell Labs Technical Memorandum 74-1273-18 on 29 October 1974.
For easier editing and reuse of sentences, or even portions of lines of text, one can (and should) write sentences or sentence fragments on their own lines in digital contexts.
This way future edits or the ability to more easily cut and paste will far easier in addition to keeping your version control files simpler and easier to read and visually track your changes. (That is in many version control systems, instead of a change appearing to affect an entire paragraph, it will only show on the single line that was changed thereby making the change easier to see.)
This particular affordance may be a particularly useful one for note takers who expect to regularly reuse their notes in other contexts. Many forms of software (including Tex, LaTeX, and even markdown) will autowrap newlines so that a sentence broken up into clauses on multiple lines will properly wrap back into a proper looking single line when printed. Take care that in many Markdown versions adding two spaces at the end of a line will automatically create a newline in your text.
-
- May 2022
-
www.linkedin.com www.linkedin.com
-
as if the only option we had to eat was factory-farmed fast food, and we didn’t have any way to make home-cooked meals
See also An app can be a home-cooked meal along with this comment containing RMS's remarks with his code-as-recipe metaphor in the HN thread about Sloan's post:
some of you may not ever write computer programs, but perhaps you cook. And if you cook, unless you're really great, you probably use recipes. And, if you use recipes, you've probably had the experience of getting a copy of a recipe from a friend who's sharing it. And you've probably also had the experience — unless you're a total neophyte — of changing a recipe. You know, it says certain things, but you don't have to do exactly that. You can leave out some ingredients. Add some mushrooms, 'cause you like mushrooms. Put in less salt because your doctor said you should cut down on salt — whatever. You can even make bigger changes according to your skill. And if you've made changes in a recipe, and you cook it for your friends, and they like it, one of your friends might say, “Hey, could I have the recipe?” And then, what do you do? You could write down your modified version of the recipe and make a copy for your friend. These are the natural things to do with functionally useful recipes of any kind.
Now a recipe is a lot like a computer program. A computer program's a lot like a recipe: a series of steps to be carried out to get some result that you want. So it's just as natural to do those same things with computer programs — hand a copy to your friend. Make changes in it because the job it was written to do isn't exactly what you want. It did a great job for somebody else, but your job is a different job. And after you've changed it, that's likely to be useful for other people. Maybe they have a job to do that's like the job you do. So they ask, “Hey, can I have a copy?” Of course, if you're a nice person, you're going to give a copy. That's the way to be a decent person.
-
- Feb 2022
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
"Context" manipulation is one of big topic and there are many related terminologies (academic, language/implementation specific, promotion terminologies). In fact, there is confusing. In few minutes I remember the following related words and it is good CS exam to describe each :p Thread (Ruby) Green thread (CS terminology) Native thread (CS terminology) Non-preemptive thread (CS terminology) Preemptive thread (CS terminology) Fiber (Ruby/using resume/yield) Fiber (Ruby/using transfer) Fiber (Win32API) Generator (Python/JavaScript) Generator (Ruby) Continuation (CS terminology/Ruby, Scheme, ...) Partial continuation (CS terminology/ functional lang.) Exception handling (many languages) Coroutine (CS terminology/ALGOL) Semi-coroutine (CS terminology) Process (Unix/Ruby) Process (Erlang/Elixir) setjmp/longjmp (C) makecontext/swapcontext (POSIX) Task (...)
-
- Feb 2021
-
trailblazer.to trailblazer.to
-
Each step receives the return value of its predecessor. The return value decides about what next step is called.
-
While you could program this little piece of logic and flow yourself using a bunch of Ruby methods along with a considerable amount of ifs and elses, and maybe elsif, if you’re feeling fancy, a Trailblazer activity provides you a simple API for creating such flow without having to write and maintain any control code. It is an abstraction.
-
- Oct 2020
-
medium.com medium.com
-
The reason that this solves our problem is: we now have full control over the module loading order. Whatever the import order in internal.js is, will be our module loading order.
-
- Sep 2020
-
medium.com medium.com
-
The benefit of this approach is that rather than having these defaults and fighting against them, it’s fully up to you to decide how to handle everything.
-
-
github.com github.com
-
Then, the projects that use these libraries get to process these import statements how they like when they are bundled. For the ones that wish to load jQuery from a global, we again mark 'jquery' as an external—since we still don't want Rollup to bundle jQuery—and as a global.
-
-
-
I wrote hundreds of Rect components and what I learned is that Componets should be able to be styled by developer who is using it.
-
-
github.com github.com
-
feel like there needs to be an easy way to style sub-components without their cooperation
-
-
github.com github.com
-
There is a good amount of properties that should mostly be applied from a parent's point of view. We're talking stuff like grid-area in grid layouts, margin and flex in flex layouts. Even properties like position and and the top/right/left/bottom following it in some cases.
-
The main reason using classes isn't a great solution is that it completely breaks encapsulation in a confusing way, the paren't shouldn't be dictating anything, the component itself should. The parent can pass things and the child can choose to use them or not but that is different: control is still in the hands of the component itself, not an arbitrary parent.
-
The RFC is more appropriate because it does not allow a parent to abritrarily control anything below it, that responsibility still relies on the component itself. Just because people have been passing classes round and overriding child styles for years doesn't mean it is a good choice and isn't something we wnat to encourage.
-
Ideally: Only let a parent control those specific CSS properties, and never let a child use them on the root element.
-
margin, flex, position, left, right, top, bottom, width, height, align-self, justify-self among other is CSS properties that should never be modified by the child itself. The parent should always have control of those properties, which is the whole reason I'm asking for this.
Tags
- constraints are helpful
- limiting how much library consumers/users can control/override
- Svelte: components are their own boss (encapsulation)
- programming: who is responsible for this concern?
- control (programming)
- whose responsibility is it?
- breaking encapsulation
- who should have control over this? (programming)
- Svelte: how to affect child component styles
- confusing
- which component/tool/organization/etc. is responsible for this concern?
Annotators
URL
-
-
github.com github.com
-
I think Svelte's approach where it replaces component instances with the component markup is vastly superior to Angular and the other frameworks. It gives the developer more control over what the DOM structure looks like at runtime—which means better performance and fewer CSS headaches, and also allows the developer to create very powerful recursive components.
-
- Feb 2015