-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve basic n4 app #34
base: master
Are you sure you want to change the base?
Conversation
Apologies: I won't be able to look at this immediately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please read https://diataxis.fr/, especially https://diataxis.fr/tutorials-how-to/.
We don't necessarily have follow it religiously, but I agree with much of what it says.
Are we trying to write a tutorial or a how-to?
``` | ||
|
||
To run this test type `just test-examples` from the top `nain4` directory. | ||
Note that we have chosen to use an existing installation of `nain4` so this example runs out of the box when run within `nain4`. If you where to copy this example and run it elsewhere, make sure to check [How to make nain4 available in a Geant4/cmake project](@book/how-to/enable-nain4-in-cmake). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, don't want to encourage use of existing nain4
installations, but I guess that until we have understood what to do about #33 and made some progress on its future children, this is probably a reasonable choice at this point.
Definitely a tutorial. I had in mind to move it to the tutorials section and then forgot. Can we do it just before merging? |
In that case, there are not enough things for the learner to do and there is too much explanation. Even for a how-to, there aren't enough active steps. Perhaps this is an explanation. Perhaps we haven't thought enough about what it is that we are writing, before having started writing it. The one thing we can be pretty sure this is not, is reference. So we should read and ruminate on
Yes, it's frustrating to slow down and think: I also want to be creating material at a quicker rate, and to see the void being filled more rapidly, but I suspect that we'll do a lot better in the mid- and long-term, if we take it a little more slowly at the beginning, here. I suspect that we are conflating a number of things, and that, instead, we should have:
And plenty more, but with less direct links to this initial effort. But I think it all has to start with the app, which should just be an app, |
I keep going back and forth about this, and I need to think about it a bit more. For now, I will just lay down a few points that I find relevant:
Many of my doubts come also from whether we are thinking in the same terms or not. I also need to absorb We should also consider the pros and cons of offering documentation quickly to satisfy the current needs. We can always take a step back and redo it, better. It's more work, but it can also give us experience and perspective (which I find very important). On the other hand, it might bias our approach and push us to repeat the patterns that we have tried already. |
Originally I had a couple of different things in mind
Then you opened your PR and I was won over by its brevity, because my template idea would throw too much in your face, and I had no clear vision of how to make the default app idea work well. But now I'm less convinced. I think that many of the tutorials and how-tos can be thought of as edges in a graph. Here's some lovely ASCII art about it:
and much more. Now,
I think we need multiple tutorials and how-tos describing the transitions:
Except that the upcoming stages to which you refer all depend on
Of course. That's
Your use of the word 'later' and the singular 'the tutorial' worry me. There will be many tutorials and how-tos, and they are not ordered in time. The reader should pick whichever one is most relevant to current needs and mood. I imagine that a good order for many people would be to do a couple of
That depends entirely on who you are, and were you are in your Geant4 learning journey. The thing that has always hugely bothered me when writing the notes for my courses (which set out the order in which things will be presented to the people I have in front of me in class, but also act as a reference document for them, not only in class, but also later on1), is that there is a pressure to cater for all possible different individuals' needs in all possible situations is a single, linear document. This is frustrating and counterproductive for exactly the reasons that Diátaxis points out. Diátaxis (and the fact that we're not aiming this at a bunch of people who will be sitting in a room and following the things we say, in the order in which we say them) is hugely liberating. Embrace that liberty! So, in summary
That depends on the reader's current needs. Sometimes it will be helpful, sometimes it will be noise. Diátaxis proposes a strategy:
Crucially, the last two can refer to explanations, but shouldn't really explain anything themselves. I'd say that
I completely disagree. For pretty much the same reasons that I think the HEP and C++ situation is such a disaster. It's a huge fallacy to believe that you can write software fit for purpose, by getting complete C++ newbie students (aka cheap/slave labour) to start writing C++ for WORK, and that a decade down the line, after having copy-pasted their way to 'success', without ever having bothered to STUDY and understand C++, a tool which is both hugely complex and fundamental to their work, they can be considered even remotely-competent C++ programmers, let alone experts. Yes, our readers will use n4/G4 for work, but if they never take the time to study them, they will only ever produce shit. Not taking the time to understand what you are doing, is as bad as not taking the time to automatically test your code. Both seem very expedient in the short term. Both are a disaster in the long term. Our immediate users, and their bosses, will be tempted to skip the study and the tests. We must try hard to help them avoid these grave errors.
Agreed. But only at the beginning.
At some stage, probably, yes.
Indeed. AFAICT, we have 2 active users. One of them got bootstrapping tuition con peras from me, and then instructed the other. The most short-term needs were covered by this. But if we are going to be users' needs-driven, then we should ask them what they need. Footnotes
|
Maybe the default app and template (as described at the top of my last comment) aren't such a great idea. If we do #8 (and #30, though that one is minor), then we can get a picture or the screen with no more than #include "nain4.hh"
#include "g4-mandatory.hh"
#include <G4SystemOfUnits.hh> // physical units such as `m` for metre
#include <G4Box.hh> // for creating shapes in the geometry
#include <FTFP_BERT.hh> // our choice of physics list
auto my_geometry() {
auto hl = 1 * m; // HALF-length of world volume
auto air = n4::material("G4_AIR");
auto world = n4::volume<G4Box>("world", air, hl, hl, hl);
return n4::place(world).now();
}
int main(int argc, char* argv[]) {
auto run_manager = n4::run_manager();
run_manager -> SetUserInitialization(new FTFP_BERT{0}); // version 0
run_manager -> SetUserInitialization(n4::geometry(my_geometry));
run_manager -> SetUserInitialization(n4::actions(n4::generator([](auto){})));
run_manager -> Initialize();
n4::ui(argc, argv).run();
} So we can probably even afford to spend an extra line on auto do_not_generate_anything = [] (auto) {}; And this could serve the purpose of default app and template in one go, and act as the starting point of all the |
Also, with #31 I'd like to reduce the run manager stuff to something more like auto run_manager = n4::run_manager()
-> physics<FTPF_BERT>(0)
-> geometry(my_geometry)
-> actions((n4::generator([](auto){})))
-> init(); We'd have to be careful to preserve the ability to inject a wider range of things than just these highly convenient/concise examples. BTW, the Moral of the story: don't use abbreviations to name your variables. |
Agreed.
Not only on
I see now that you were not thinking about a linear tutorial but rather a pick-your-choice scheme (perhaps with a suggested route through the different tutorials). I am definitely the kind of person that would take a linear tutorial, but that's my personal preference.
Agreed.
I fully agree. But if I understood the situation correctly, we needed something digestible for last week. I was assuming we had to provide a first step to get the users jogging, even if they fall because they don't know how to walk. In order words, give up on creating a good documentation for the first users (who need something now) and focus that effort on the future users. But seeing this:
it looks like you don't want to go down that route.
This looks very good to me. We can even avoid pointers in the interface. |
I suggest we proceed roughly like this
I'm sure that we will have changed our mind by the time we get this far. Getting the user to write tests, needs to be part of each of the above, from What do you think? |
Sounds more than reasonable. Is there anything specific that you want me to do or should I start tackling them one by one in that order?
I've only done the first one, but I am trying to bring every action into the game. |
I think that one of us should do 1 and the other do 2. When we've reviewed and merged them, we'll be ready to polish off 3 (which is this PR, essentially). Then we can decide how to proceed further. Or, if you prefer, maybe we can do 1&2 con peras. I should be available most of tomorrow. |
I have a few things to get done in the morning, I'll let you know. |
I propose a slight change of strategy. I get the impression that the documentation is not that urgent right now. So how about concentrating on building up an example app, approximately as laid out in #34 (comment), without writing any documentation yet? But we should keep in mind that the evolution of the app will be used as the core of the documentation. We shouldn't write too much undocumented stuff: writing docs, like tests, is never much fun and produces poor quality material, if they lag too far behind the implementation. OTOH, writing docs takes a lot of time, and having to rewrite them because the implementation changes, is also a huge burden. Developing a big example app should give us a more stable implementation to document. |
Sounds good to me. What about the interface for setting/building actions? Which one takes priority? |
The actions interface requires a stroke of inspired insight, to get us anything significatly better that what we already have with If and when we come up with a better actions interface, it shouldn't be too much work to adapt the app. So I'd say the app has priority. Probably starting with the UI abstraction, which I suspect will be the least fun. |
The last two client-side tests are failing, because of missing OpenGL stuff. I'm struggling to understand what is going on. You are much more familiar with this whole setup, so I guess you'll see it immediately. |
Hmm. The other two tests pass because it's using v0.0.2. Looks like including the ui in nain4 forces the client to add the same boilerplate to the cmakelists that we added here. |
Perhaps, if there is not a huge downside we can include the ui always to reduce the noise? |
With this commit the tests pass |
ab56631
to
db96a5b
Compare
2f9a6c1
to
0cc5a27
Compare
This has become partially obsolete, but it contains an interesting discussion about how to organize the tutorials. We should summarize it and put in an issue so we can close this. |
d07637c
to
80f6f77
Compare
This addresses the comments raised in #7. In this PR, we move the basic app to a subfolder and provide documentation on how to compile and run the app.