-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
Documentation for Feature class #565
Comments
@aneilbaboo Thank you for the outline. I agree that this kind of documentation is of great importance. Currently we are busy with improving other parts of this kit, but would be really grateful for any kind of help in this area. If you would be willing to start writing docs for some of this parts on your own, we can help out and fill in the missing parts, when time permits us. |
For starters we can create a |
Hi @mitjade I haven't quite grokked what is going on here myself. I'm a React newbie, so if there's someone else reading this 👋 maybe they can take a crack? I'm evaluating a number of different frameworks right now. If I settle in on this repo, I might be able to contribute. |
For example, I only have a vague understanding of what the feature class is doing, where it is invoked, when to use it, etc. If someone from the team could fill in at least the overview section, that would be a good start. |
@aneilbaboo Thank you for your feedback. Will try and put something together when time permits us. |
I can put something in about Features with my upcoming auth docs. Here are some pointers in the meantime:
In the I have some examples of:
|
FWIW, I've settled on this kit. I have to say, now that I've wrapped my head around React and looked at a number of other starter kits, I really love the approach taken here. I'm going to write up some documentation. One thing that is a bit confusing for newbies is the naming convention. Folders in the modules directory export Feature instances and the Feature class is found in connector.js. It causes a bit of unnecessary boggle having all these names floating around. @verdverm @mitjade - what do you think of unifying these names under "module"? Feature=>Module, connector.js=>module.js? Or to make this crystal clear, Feature=>ServerModule+servermodule.js / ClientModule+clientmodule.js? Changing the names will make the docs more readable too. |
@aneilbaboo The thing is this schema is platform agnostic. It is fully abstract concept. I call it feature-modules. But I agree that naming can be improved. So no reason to have servermodule.js or clientmodule.js, this unnecessarily shrinks down the meaning, because feature-modules can be used in other places of the kit and one feature-module can be a host for many other sub-feature-modules. |
Feature-modules is an attempt to have Interface-like concept in JavaScript. We connect all the modules in |
@aneilbaboo All ideas how to improve the naming as well as writing docs are highly appreciated. It is difficult though, considered this kit is used also with TypeScript and with Flow that really have interfaces, but we needed something more portable and available in vanilla JavaScript |
Yes, and they do actual work. What I really like about it is how they formalize the structure of the project, and enable composition. That's more powerful than just being interfaces. It's a key selling point of this kit, IMO, and the fact that you offer the CLI for generating and wiring them in to the infrastructure is great, especially for newbies. Honestly, I think think this is the best kit out there. The weakness is documentation and naming. I could see how the CLI would expand over time to include more and more generator patterns, and maybe plugins. React apps ought to be as easy to spin up as Rails. It feels like your module concept is a step towards that.
I see. I agree with the thrust: it should be clear that Modules are an organizing principle. (By the way, I prefer "modules" to "features" because it conveys the idea of "self-contained package"; "feature" does not). I think the way to do this is to tell that story right at the beginning of the documentation, and make that the point of this kit. It's not great to different classes with slightly different functionality in the same project. But, if the naming is fixed (Feature=>Module; connector.js => module.js), this isn't terrible. The folder and file names will tell the story. Anyway, I'm willing to take a crack at this, and write up some documentation if you're game. |
@aneilbaboo That is great news! If you are interested in things to come for CLI generation, check out #524 for CLI that generates full CRUD. Far from complete, but I already use it in one of my projects. |
Cool. This module concept is really powerful. Imagine an NPM-like repo. I think there's a business here. I have a bunch of ideas, if you want to jump on a chat sometime. |
This kit is full of hidden undocumented gems 😉. @Vlasenko is the mastermind behind it all. |
@aneilbaboo We have a chat for this starter kit here: There are too many things that need to be handled, so we try to help on all the directions. At the same time we understand that there are many things to be finished and there are still many challenges that need to be handled to make this starter kit more useful. |
@aneilbaboo I think naming is very important, so we should probably think and agree on some good name for this concept of organizing code and what filenames should be used in our implementation. Both the name of concept and file naming should reflect the idea well and should be easy to remember and distinguish from other concepts. |
I'm thinking about renaming it as follows: |
I'm fine with |
@Vlasenko, good thought. I like Plugin too (better than "interface" since interfaces have no implementation). Module conflicts with the Node.js concept of modules. So then we would have these changes:
Are you comfortable with this? I could see this being a bit disruptive to existing work in progress. |
@aneilbaboo Yes, I'm comfortable with this and yes it is disruptive to current WIPs. And I would love to hear opinions. @mairh @mitjade @verdverm @johnthepink do you have some opinion on this matter? |
I don't mind the current naming convention, but "Plugin" does feel like it may better communicate to newcomers what we mean when we say "Modular". |
I agree with @johnthepink. |
Fine with me. |
Great. I'll submit a PR with the refactor and another PR on top of that with the documentation. |
I'm not sure about the naming change yet... it's one of the (2 or 3) hardest problems in CS ;] This is how I have been thinking about it:
Some examples I have been thinking about as I think about this naming change.
This is like a module with features you can turn on and off. Maybe you want users and groups, but no orgs. You could have different plugins for auth methods and storage of secrets (Vault anyone?.
GraphQL is cool because you can use anything that returns data in your resolvers. This could be SQL, NoSQL, Cloud storage solutions, Blockchains, any other API, and just about any function that returns some data. So we want to abstract this and have something that allows for a plugin style for these drivers. This would mostly be about config and initialization.
They have an excellent third-party-resource system and plugins. There are a lot of people who have put a lot of thought into naming things. We should see how they came to their deciscions. Overall, Kubernetes is a significant project and run quite well. I think the community and how the project has evolved is a So yea, what do we want to call things? Good question |
Hmmm, maybe we pull the connector.js files into the Something like
This way
Now, where and how are the features used in the rest of the codebase? That's a question I have yet to understand the answer to. How would different server modules (substitute client as well), |
@verdverm I've been thinking of this renaming as well and you raised a few valid points. Maybe we need to step back a bit before we do mayor renaming changes and first see where we want to go with this in the long run. |
@verdverm I don't think we should separate out
|
@aneilbaboo @mitjade I'm thinking about this renaming too. And I think we don't win much by renaming everything into |
Good thoughts. I think it's a good idea for existing team to drive on a change as sensitive as this. I'm going to step back Let me just give my newbie perspective, as you think about it. I'm just one data point, so please take this perspective with a grain of salt: I was really confused initially because of the naming scheme. I scan code and documentation to get a high level view of a project. Scanability is useful for new users, but also for reducing cognitive load for existing ones. Currently, there is a class (Feature), exported from a file with a different name ( Merely documenting this isn't a great solution, IMO. A new user scanning (i.e., not reading carefully, which is most people) the documentation will think there are more concepts than actually exist, and might struggle to understand the relationship between them: "How is a Feature different from a module?", "Is there a difference between 'feature modules' and 'modules'?", "Why is this called connector?", "Is there a relationship between the sql/connector and the client/src/connector?", "why do the modules export Feature instances?", etc. Then, either the documentation reminds the user how the words are related throughout, or one section explains that Feature=connector=modules. So the choice is between bloated documentation or risking a confused reader. Alternatively, if someone carefully reads the documentation, they'll wonder why so many different names are used for the same thing. Then, even if they read the section explaining these things are the same, they may forget. Also, using multiple names for the same concept reduces the number of names available for new concepts. What if an actual "connector" is required at some point? It's possible to envision a future need for cross-cutting "features" which work across modules, for example. Better to straighten out names sooner rather than later. If the goal is to provide continuity for existing developers, it's probably better to keep the naming scheme as is. If it should be easy for new users to understand and start using the kit, renaming is going to help a lot, IMO. Anyway, guys, please take that only as one "product feedback" data point. @Vlasenko, hope you have a good vacation! |
Thank you @aneilbaboo. Yes, it is understood the naming is not perfect and confusing now. We are going to fix this soon. |
I was thinking about how to make the connectors more duck-type-y. I've experimented with merging different types or exporting multiple merged Features from the same module. What I'm thinking something like modules exporting the config object, rather than wrapping it in the "Feature" at the start. Then when / where a feature is needed and paired with a module, the correct kind can be used. And because they are exported under default names, you can call "Feature" whatever you want when you import and use them. This allows the module to be configure for multiple consumers or features. I'm still confused by how flexible it is. A module and be both a "module" and a "feature(s)" have sub-features/modules and import other module pieces or user their "Feature" to render something (like a menu) If we move to objects being exported rather than features, I think the merging and duck-typing will be easier. Maybe the connector.js can merge fields, so that it doesn't need a predefined set? Maybe we use something like prop-types to ensure a feature has the necessary config provided by a module when it's instantiated? It's pretty deep, and way awesome! I think some docs and examples would go a long way for sure! |
has anyone started on this? Just wondered if there's a fork / branch / PR lying around somewhere with an unfinished attempt. Failing that, where would be the best place to see an implementation of a Feature subclassing other features ? |
@leviwheatcroft We use feature |
Just trying to get my head around features like @aneilbaboo, so there's still big gaps in my understanding. This might be vaguely related to what @verdverm suggested re: exporting objects. It looks as though some of the confusion might stem from the fact that the main purpose of the Feature class exported by connector.js in both the client and the server is to connect modules together. Other than providing getters the class doesn't do anything else. So whilst If the Feature class were to provide any logic, perhaps that would be better subclassed, so Then connector.js should return a connect function with the same pattern as the current Feature constructor. So if you were defining features with plain objects you'd have:
You could still have a Feature class in connector.js if that's the most appropriate, but beginners / visitors wouldn't really have to think about it. Instead of worrying about what Features, connectors, and modules are, you'd only be thinking about modules, and |
I've generally been thinking Connectors or Features can show up anywhere in the directory / conceptual structure. They get brought together as the code / files are imported down to the "root" (This is much like index.js is used generally in JS). At the "root", all of the client/server modules should be present. Today, consumers import this file directly (which is causing some circular imports). With Here is an example of how I've started to organize the connectors after refactoring to have modules with client/server code co-located. In also uses Root Connectors (the |
The Feature class seems like a key conceptual and organizational unit. It's used throughout the code base, but there's no documentation. Adding documentation for this particular item would be pretty high impact, IMO. It would make it much easier to use for beginners.
Here are some thoughts for an outline:
Feature Class Documentation
new Feature(counter, post, user, graphqlTypes);
in modules/index.js`The text was updated successfully, but these errors were encountered: