What is SBT global Scope? - sbt

I have red the Doc on the different Scopes in SBT, but I have trouble being comfortable with the global scope Axis. I just don't understand in simple terms what does it correspond to?
Can someone provided a more elaborated but simpler explanation of the Global Scope than what in on the current Doc.
My first guess is that it is something encompassing the project scope.
Something like for all project.
I would appreciate if one could take a bit of time to explain it.
Many thanks,
M

Related

Why is Vue3 composition API better than just a helper class?

Maybe it's just me, but after diving into the new Vue3 composition API, I don't really see the benifit of it, compared to just creating a new class that exports some helper functions (functions to prevent duplicated code). Can someone please clarify this for me?
official doc actually has a pretty good detailed explanation with examples, you can check step by step starting from here: https://v3.vuejs.org/guide/composition-api-introduction.html#why-composition-api
The most important is:
Such fragmentation is what makes it difficult to understand and maintain a complex component. The separation of options obscures the underlying logical concerns. In addition, when working on a single logical concern, we have to constantly "jump" around option blocks for the relevant code.
Any helper classes can minimize logical concerns fragmentation. So everything is almost next to each other, but still you'll have to separate and put them to different Options api sections (data, watchers, computed, etc)
It can't eliminate mentioned "jumps" around option blocks.
It would be much nicer if we could collocate code related to the same logical concern. And this is exactly what the Composition API enables us to do.

why use pointers

I'm learning C++ on my own. I'm an EE and learned it about 20 years ago, but in the progress of my career I stopped programming and didn't take it up again until recently. I should add that I never took any classes in programming.
I have a theoretical question about pointers. In reading the books about pointers it seems they have an important role in C++. My problem is that I can't see what that is. I see that pointers have a role in arrays, but I can't see their role in anything else.
I can see what they do, but I don't see why use pointers in the situations I see them in. Either references or straight variables would work just as well. I have a feeling the answer lies in the area of memory ( it's optimal use), but I just don't know.
Any answers would be appreciated. Thanks.
Consider the following from cplusplus.com:
"[T]here may be cases where the memory needs of a program can only be
determined during runtime. For example, when the memory needed depends
on user input. On these cases, programs need to dynamically allocate
memory, for which the C++ language integrates the operators new and
delete."
If you could determine all your memory needs prior to run time and did not need to make use of any abstract data type like a linked list, then yes, it would be difficult to see their use. However, what if you want to store values in an array, but you don't yet know how big that array will need to be?
Another value of pointers arises when you consider passing values from function to function. You may find this thread of value regarding the differences between pointers and references in C++ and how/why to use each.
We have been having several pedagogical conversations focused on pointers on the CSEducators.SE site. I'd encourage you to read those as well:
Simple Pointer Examples in C
Lesson Idea: Arrays, Pointers, and Syntactic Sugar
Pointers come from C, which had no concept of reference, and which C++ inherited from.
Everything that can be done with a reference in C++ is done with a pointer in C.
I find this question really great because it is pure.
A programming language is considered "safe" when the programs written in it can only call functions and access data that the program can name.
Now, the concept of pointer was invented to break this sandbox of safety and provide developer with freedom to think and act outside of the box.
Think of pointers as poor man's tool to achieve something not provided by the programming language itself.
It is misleading to think you could achieve higher performance if programmed some algorithm using pointers. Optimization is privilege of the compiler and hardware, not human.

OpenMDAO: finite difference flag for Component.solve_nonlinear

For some of our components it would be useful to know whether it's being executed as part of a finite difference calculation or not. One example could be a meshing component where we'd want to maintain the same node count and distribution function during FD and allow for remeshing during major iteration steps. In the old OpenMDAO we could detect this from a component's itername. Would it be possible to reintroduce this or is that info already available to the Component class?
I can't think of any current way to figure out if you are inside an FD when solve_nonlinear is being called, but it's a good idea for the reasons that you mention.
We don't currently have that capability, but others have also asked to be informed when solve_nonlinear is being run for complex step as well.
One way to do this would be to introduce an optional_argument to solve_nonlinear such as call_mode="fd" or call_mode="cs" or call_mode="solve". The only problem with this approach is that its very backwards incompatible.
Another approach would be to add a regular python attribute to the component that you could check like self.call_mode="solve", etc. This one would be a pretty easy change and I think it would serve the purpose.
One last possible way would be to put a flag into the unknowns/params vector. So you would check params.call_mode to see what mode. This is somewhat sensible since its the param values that change when you're going to complex-step.
I think I like the last option the best. Both solve_nonlinear and apply_nonlinear need to know about this information. But none of the other methods do. So making it a component attribute seems a little out of place.

Reflect, generate, compile, execute, disassemble, decompile, reflect

Before heading back to business, I decided to take a few days off for recreational coding. A few 30-hour days without fresh air? Sounds fantastic, for a change.
I've struggled with managed code generation over time and always wondered if there is a circular relationship between C# code, reflection and codedom. Never got around to exploring it sadly. So the goal is to create useless and annoyingly complex classes with nested generics, constraints, anonymous methods, delegates, nested complex reference types, etc. and use reflection+codedom to regenerate their source code from a class called CodeGenerator<T> where T would be the useless classes.
The inspiration came about from revenge frankly. Having a company to run takes you away from programming, and doing hobby projects in your nonexistent free time becomes frustrating due to lack of practice and being out of touch. I feel like an idiot right now but I'll show you! Stupid CLR! That said, please don't mistake this for a joke. I take these little vacations very seriously.
This came up most recently while trying to achieve this. I wanted to generate code without using string manipulation and was stumped at how to create a new XyzObject() constructor call at runtime. I do NOT want to use default(T) because it sets reference types to null. There HAS to be a way. Stupid CLR!
Why SO? Well, it should be a fun discussion to start with. Much to be learnt here.
So the plan:
Create a few useless and annoyingly complex classes.
Respond to amusing and/or silly suggestions from SO members (hopefully).
Attempt to traverse useless class structures using reflection.
Get down voted for getting stuck and asking stupid questions.
Successfully traverse useless class structures using reflection.
Attempt to regenerate code for useless classes using codedom.
Get down voted for getting stuck and asking stupid questions.
Successfully regenerate code for useless classes using codedom.
Gain knowledge along the way.
Use said knowledge on unsuspecting developers back home to enforce conventions through code generation.

Function Programming and Mock Objects

I was recently watching a webcast on Clojure. In it the presenter made a comment in the context of discussing the FP nature of Clojure which went something like (I hope I don't misrepresent him) "Mock objects are mocking you".
I also heard a similar comment a while back when I watched a webcast when Microsoft's Reactive Framework was starting to appear . It went something like "Mock objects are for those who don't know math")
Now I know that both comments are jokes/tongue-in-cheek etc etc (and probably badly paraphrased), but underlying them is obviously something conceptual which I don't understand as I haven't really made the shift to the FP paradigm.
So, I would be grateful if someone could explain whether FP does in fact render mocking redundant and if so how.
In pure FP you have referentially transparent functions that compute the same output every time you call them with the same input. All the state you need must therefore be explicitly passed in as parameters and out as function results, there are no stateful objects that are in some way "hidden behind" the function you call. This, however, is, what your mock objects usually do: simulate some external, hidden state or behavior that your subject under test relies on.
In other words:
OO: Your objects combine related state and behavior.
Pure FP: State is something you pass between functions that by themselves are stateless and only rely on other stateless functions.
I think the important thing to think about is the idea of using tests help you to structure your code. Mocks are really about deferring decisions you don't want to take now (and a widely misunderstood technique). Instead of object state, consider partial functions. You can write a function that takes defers part of its behaviour to a partial function that's passed in. In a unit test, that could be a fake implementation that lets you just focus on the code in hand. Later, you compose your new code with a real implementation to build the system.
Actually, when we were developing the idea of Mocks, I always thought of Mocks this way. The object part was incidental.

Resources