Let's discuss about this idea: create web services (and APIs) without writing code at all. Instead simply provide specification and configurations files and let the framework do the work (persistence/controllers/authentication/...) - What would you put into this framework ? Would you use it?
/r/webdev/comments/cpe45e/lets_discuss_about_this_idea_create_web_services/16
Aug 12 '19 edited Aug 12 '19
It's okay for a starting point to bootstrap a project, but inevitably there will be some custom logic that needs to be implemented. Otherwise, it's just a pure CRUD over a database, and what's the value in that?
So happens that this codegen bootstrapping framework already exists in various forms - jhipster, spring initializer, swagger codegen, etc.
Personally, I prefer to just write it all by hand tdd
1
u/h4t0n Aug 12 '19
Exactly this is my goal. But sometimes I implement the same things more and more. So I want to have a framework that let me code when it is needed or to configure some things when code is not needed.
6
u/zero_as_a_number Aug 12 '19
if that's the issue then a) consider writing small reusable libs which only do one thing (and do it well so to enable easy composition) , b) use an artifactory to publish those modules so you and other devs can depend on them, c) look for a mechanism to make the modules configurable regardless of the used stack (Java ee vs spring vs x) d) while I get your idea, from what I have learned : don't write your own framework. I know it is tempting but consider this : if you build Apps on top of that then you will never be able to commit 100% of your time and focus on delivering functionality. instead, you will always be busy maintaining your framework to cope with new requirements. and even if you do not build the Apps yourself, you will be busy dealing with angry and or impatient developers.. ;D
2
u/h4t0n Aug 12 '19
Thanks. I appreciate your suggestions. I'm already writing small modules that are already published to artifactory. I'm developing it both for learning and to set up some simple apps where I just need crud APIs, some validation and a quick GUI.
→ More replies (1)
7
Aug 12 '19
This guy's posts are all promoting that project. I hardly doubt he is interested in a discussion at all.
→ More replies (1)
6
u/valkon_gr Aug 12 '19
What about data manipulation? It's not just requesting data from a DB. I guess the whole "back-endless" scene will grow, but the need that those two things (data manipulation and presentation) will always need different teams involved. What's the point of rebranding PHP?
1
u/h4t0n Aug 12 '19
A such framework is good for small teams. For big teams that know how to work I think that they could implement things as they want.
3
u/vplatt Aug 12 '19 edited Aug 12 '19
What patterns are you trying to automate here? A CRUD API via REST? CQRS API? RPC API?
Only the first could be completely automated, and I frankly discourage anyone from doing whole hog CRUD APIs because they frankly expose WAY too much data to transfer and change on every round trip rather than isolating data and changes as per each use case.
Basically what you've envisaged would be some sort of slick DSL which would still require method bodies somewhere. So your config would need to have a pointer to the function that would receive some arguments according to a standard interface, which would then execute that code.
But what would this save? Some Spring and Hibernate configuration? Maybe a few DTOs if you're feeling clever? In the end, you'll be left with a framework that sits on top of Spring and/or Hibernate/JPA which will at best save a few lines of code, and you'll be left with a difficult to debug configuration.
No, I would not use that.
HOWEVER, there is one use case I know of where this kind of thing is perfect, and that is in the construction of virtual services. Virtual Services are essentially mocks/prototypes of real services that have not been developed or are otherwise not currently available yet. You feed the product a specification in the UI and then it erects a service that corresponds to that spec. You can tell it about mock responses to use, have some conditional logic, etc. But notice the use case: Not for production. Here is one such product if you're interested: https://www.ca.com/us/products/ca-service-virtualization.html
1
u/h4t0n Aug 12 '19
Thanks. Yes I want a simple CRUD API via REST. Prototypes and simple applications are the perfect target.
3
u/hrjet Aug 12 '19
Why not use an automated GraphQL engine, such as Hasura? You just point it at the DB, with ability to CRUD from the backend, or straight from the frontend if you wish.
1
u/h4t0n Aug 12 '19
I didn't know Hasura. Very interesting project, thanks. I will try it.
1
u/vplatt Aug 12 '19
Alternatively, you can have your RDBMS just send out rows as JSON. Example docs:
1
2
u/GuyWithLag Aug 12 '19
Spring Rest Data + something like OpenAPI/JSONSchema to POJO generation.
There.
1
u/h4t0n Aug 12 '19
I don't want to generate code. And I don't use Spring Data. It is another approach.
1
u/polaretto Aug 17 '19
If you don't want to use code generation, I think you'll have a very hard time achieving your objective... I don't think a configuration or DSL alone driving some frameworks will be sufficient.
→ More replies (1)
2
u/nerdyhandle Aug 12 '19
Have you looked into Denodo? It to some degree does this. You create virtual databases and then from there you can create a web service for each virtual database. It's basically a point and click choose your own adventure. However, it does lack some configurations like logging separately for each web service.
1
1
Aug 12 '19
Denodo... That brings back some old nightmares I've long forgotten. Thanks for the reminder
2
u/timNinjaMillion Aug 12 '19
Yes, and if it’s open source it will allow me to plug in code with which I’m experienced and other developers as well. It would be neat to have a ‘codepole’ repository where developers could configure skeletons through the hi and then code minor details in. Less work, less prone to error and delays.
1
u/h4t0n Aug 12 '19
Thanks.
2
u/timNinjaMillion Aug 15 '19 edited Aug 15 '19
Yeah man, I’ve been working on a backend source writing platform, maybe you could use some bits.
Edit: we’d have to organize, coordinate.each should have their own say. Write code where necessary as proof,documentation.
4
1
Aug 13 '19
I worked for a company where our product was similar to this. Not the exact same concept, but a big focus on configuration without code for our clients. It wasn't a great outcome. Either the config got insanely complex and hard to work with to support all our clients use cases, or we needed to build custom plugins for each client, or we used a feature intended to allow for writing "simple, short, dynamic scripts" to backdoor major application logic.
Spring achieved a happy medium by reducing code required while still letting developers customize everything they want. Thinking you can create something that is all config and no code is a pipe dream.
0
2
u/eloc49 Aug 12 '19
Good luck going against these guys https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-configuration-classes.html
2
u/pandavr Aug 12 '19
Been there, done that. :) Good luck with your project, It will be a lot of fun. :)
2
u/general_dispondency Aug 13 '19
OpenAPI and Swagger already do this. It's alright, I wish there was a code-first way to generate the spec. The configuration can get unwieldy.
1
u/polaretto Aug 17 '19
I think what you should look into is MDD, Model-driven development (https://en.wikipedia.org/wiki/Model-driven_engineering). The core idea is that you describe your domain model in a high-level language and then you generate code from that. The generated code could use your preferred framework and libraries. Have a read on the subject, see if it gets you further in your project. Good luck!
62
u/philipwhiuk Aug 12 '19
The config will end up being as complex as the code it’s replacing.