-
-
Notifications
You must be signed in to change notification settings - Fork 542
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
Code generators #29
Comments
+1 I would like a code generator to build a microservices structure, I think is the best options for small and larges apps because a large apps before it was a small app and besides It will give us a quickly beginning with our new app. And of course, implements with #23 binary it would be a nice icea ;) |
I can go along with this. For using the microservices architecture you've laid out, I'd just really like to see more detail on what (if anything) goes under @jodosha, what are your thoughts on the "modulized" application structure you laid out as compared to microservices? I'd finally really, really like to see the generator plus probably a tutorial or two on how to Gemify components within your Lotus app; I see that as one of the great largely missed opportunities in Rails, despite the efforts of Ryan McGeary and others several years ago. Ruby has a mechanism for sharing and reusing code that's so simple and effective other platforms' developers would almost literally kill for it; it would be huge if we could leverage that. I'm probably a month away from having significant time to do more than cheerlead and/or throw popcorn until late July, but I am working at spooling myself up in Lotus as I get free cycles before then. Thanks again, Luca and team, for building something that could/should/will be great! |
The generator is in development, I was waiting for the PR containing the initially binary to be accepted. I am working on a tech talk for my companies lunch and learns and will be posting it almost immediately after as well. I'll keep the community posted, I am sure some tutorials will spring up prior to the generator being committed. |
Maybe we should think about generators, plural, especially if we (think we might eventually) want to support, say, microservices vs modulised architecture? How to structure the modules making up a generator so that (possibly large portions of) it can be repurposed to generate functionally equivalent but differently structured apps/components without adding too much bloated cruft to the output? That would be a neat trick that, e.g., Rails' "do things the curators' way or do it all yourself" generators explicitly don't even try to perform. Just thinking out loud during a break in a very long "day". (It's midnight here and I'm on for another 3 hours.) |
@jdickey RE sessions, backend/frontend: In my day job at Litmus we have the frontend app, that's the one that our customers see everyday. They login with username and password, we handle sessions for them with a custom authentication system. Deployed on the same server we have a backend app, which is only for staff members. For security reasons we keep the sessions of this application separated from the one of the customer facing app. I hope you're still following me.. Well, that example in the README is trying to replicate this scenario. @ryanyogan @jdickey RE generators: yes we probably need more than one. But let's start with the first that supports microservices, because it enforces the naming convention that I prefer the most with Lotus: |
To start I just want to get a base skeleton structure generator in place so more individuals can get to exploring the framework. This framework absolutely has some amazing input already and once the pavement has been laid, I have no doubt the community will start cranking on some amazing ideas. I must personally admit I still have much to learn about each individual module that makes up this framework. I can only speak from what I am doing with my company regarding microservices and how I have traditionally separated concerns. Can you give more insight into how you see this framework being broke apart into a modular architecture? I think that paradigm means something different to almost every Rails developer that has spent years picking apart the framework into their own idealistic modularized framework. |
An interesting concept nonetheless, the only thing I see as a down side is confusion on where do I start? Should I create a microservice or should I create (to be defined) a modular app. What are the pros and cons? For starting out, there will need to be quality documentation and having one way of creating Lotus applications will help the community jump on board with a lower learning curve... My 2 cents |
@ryanyogan That totally makes sense: generators help devs to get onboard quickly. |
@jodosha Understood; your comment clarifies back-end/front-end auth nicely. And I wasn't disputing the "let's start with microservices" approach; just saying "let's keep in the back of our minds as we're developing this generator that there are likely to be others, so not making componentisation/reuse unduly arduous would be a Very Good Thing." @ryanyogan agreed about "[breaking] apart into a modular architecture". To me, that says "make turning components/features into built or unbuilt Gems a no-brainer". Your mileage will vary. And agreed; documentation is something we have to get "right" very quickly. I know of at least two other frameworks/major components for which inadequate/outdated doc was at least a major supporting cause of death. And finally, @jodosha, I can relate to wanting the naming convention "to become a standard for Lotus applications." I'd humbly suggest recasting that as "to become a standard for Lotus microservice applications, and a default for other supported architecture(s)." |
+1 @jdickey |
@jdickey What do you think about a combined modularized/un-built gems structure, where modules exist as described in #19 which can then be extracted to built/un-built gems. I don't really like this "modularized" application structure. It is not a huge departure from the rails way, If later I with to extract a built/un-built gem i am forced to go searching through the app to get all related code, where as in #19 I just have to extract a folder which has most if not everything, even routing for the module. If a new dev joins the team its easy to point them to a module and not worry they will mess with functionality others are working on. Such an approach would allow @jdickey approach where gems are extracted early, while also supporting a delayed approach to gem extraction. |
According to the chosen architecture, this feature should be able to set the right values in for the application's configuration. For instance, |
I was pretty busy with work and wanted to know if any progress has been made on this, would anyone like some assistance this weekend on getting this out the door? |
Any news on this? |
@jodosha in # Microservices architecture
app:
- backend:
- application
- controllers
- public:
- fonts
- images
- javascripts
- frontend:
- application
- assets
- controllers # Modulized application
app:
- controllers
- templates
- views
public:
- fonts
- images
- javascripts So i have config like this i think generators can generate any structure folder. What do you think? If this interesting case for lotus i can try realize some test version. |
@fishbullet What if the config file is missing? And where it should live? |
@jodosha if config file missing this should raise P.S. i think this support lotus case because i can create any structure of my project just declare in one file where folders should be placed. |
I prefer use generator like this:
or
or something like this instead using yml |
@AlfonsoUceda So have only 2 ways for generators? (modulized, microservices) what if i don't want use one of it and how about: |
@fishbullet To recap your proposal: % lotus generate bootstrap-configuration
% vim configuration.yml # add all the wanted directories..
% lotus new --configuration=configuration.yml Is that correct? If yes, I find it cumbersome. What we need to do for now is to offer a bare minimum skeleton, plus the microservices and the modulized options, like @AlfonsoUceda suggested. For the future, I'd like to have something more flexible with a descriptive file (eg The last point about Lotus flexibility isn't about code generators, but about the properties of the framework. As now Lotus provides modularity (multiple micro apps running in the same process) and adaptability to the code structure that a developer decides. Code generators are just a facility, you can create that directories manually and the framework already works. |
@jodosha okey. i know many I have another idea, lotus generators can generate file one by one and after dev can organize how wanted. lotus generate controller:main:one_file
... generate controller .... and result can be (this some example inside or without): module Controllers
module Main
include OneFile::Controller
action 'Index' do
def call(params)
end
end
end
end
# Action example
# class Show
# include Lotus::Action
# def call(params)
# ...
# puts params # => { :"rack.version"=>[1, 2], : ... }
# end
# end or model generator repository: lotus generate model:article:repository
... generate model .... result: class Article
include Lotus::Repository
# ......
end or model generator entity: lotus generate model:person:entity
... generate model .... result: class Person
include Lotus::Entity
self.attributes = :name, :age
end What you think? P.S. and can realize geerators for microservices scaffolding or modulized and put in to right folder |
Popping back in after too long a burial... First, for the record, I loathe Yaml files for config. Especially when you've a standard or two to default to, it makes life nicer in quite a few ways (think testing, for one) to use a Ruby object. Have default config objects baked into the framework — which solves the 'missing config' problem; there's an overrideable default. Yaml config may make sense in a hackish setting where the config or other data being defined is in a state of flux. For things like baked-in defaults, though, Ruby code is generally safer, faster, more easily testable and maintainable, and far easier to find an errant typo in. YMMV, but beware. There are a few directory-builder-per-config classes out in the wild, and I've been meaning to write my own take on such for some time (pertinent to @fishbullet's earlier comment, inter alia). All IMAO, of course… </hand_grenade> |
@jdickey 💯 Nothing to add, I totally agree. |
In order to streamline the getting started process with Lotus, we want to provide an application generator. The implementation can take advantage of the code that Lotus CLI offers (see #23 ).
One pending question is about the default code structure that we want to support. After a lot of experiments with Lotus apps, I vote for microservices.
That architecture encourages developers to keep all the code under the application module and to not pollute Ruby global namespace. This makes easier to build/run multiple applications in the same repository / process and to eventually extract them, as the code base grows.
The text was updated successfully, but these errors were encountered: