New Web Framework?
Gunnar Gissel

Gunnar Gissel @monknomo

About: Saving fish by writing code! Applications developer in fisheries, specializing in webapps and moving 'enterprise-y' legacy systems to modern agile systems - Email or tweet me if you want to talk!

Location:
Alaska
Joined:
Mar 24, 2017

New Web Framework?

Publish Date: Sep 10 '18
44 24

I've been working on a web framework, but before I go any further, I thought I should check to see if anyone else is interested in the type of framework I'm building.

Web developers build all kinds of things, but one of the most common things they build are forms. Order forms. Email signup forms. Business process forms. Forms to enter data from a fax. All kinds of forms.

These kind of webapps usually have some html, a custom webservice, some middleware to do business/database stuff and a database.

I know I get tired of writing the webservice and the middleware boiler plate again and again. The forms change a little, and you need to either write a fresh webservice and fresh data access objects, or make your existing webservices even smarter.

What if there was a tool that could inspect your html pages and generate a backend for you?

I think something could inspect a form, make sensible default table and column names and web services to populate them. Done right, the tool could make something that would require very little manual tweaking. I think a tool like this would let web developers put time into what they care about (delivery quality products and making money) as well as what the customers care about (having good looking web page that do what they want).

Would anyone else be interested in a tool like this?

Comments 24 total

  • Ben Halpern
    Ben HalpernSep 10, 2018

    I think this could be useful if it fits in just right. Would this be designed to sort of fit in as a JAMstack utility tool? Would want more details.

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      JAMstack is a really useful term that comes close to what I'm imagining. My quibble is that I'd like to get away from editing so many templates for simple applications. Sometimes, I just want to make the app, rather than make the templates to make the app.

      In my minimalist, non-JAMstack conception, I picture a utility that you feed a form to. It outputs a Dropwizard application. When you run the application, you may go to an admin interface that walks you through the configuration you need to do (credential setup, where is your database, what's the address). From there you can create the initial database structure and have an administrative view of the data you've collected and your api docs. It also would host the form and provide an api.

      In my maximalist, possible SAAS conception, I picture a service you give your form to you. It asks you the configuration quests, then creates a storage bucket and a lambda, hosts the static file and gives you a useful admin interface. Explains how to integrate into the rest of your site.

  • Casey Brooks
    Casey BrooksSep 11, 2018

    A couple links you might be interested in:

    Netlify Forms - any JAMstack site hosted on Netlify has exactly what you described built it. They will find forms in your site with the data-netlify attribute and automatically start collecting its submissions in your dashboard for you. You can set them up to post to any webhook on all submissions so you can do whatever you need with the data after that.

    October CMS - A newish php framework, built on top of Laravel. A big feature is that it makes the development experience almost trivially easy for common use cases of web server development, especially in building backend forms. It is amazingly powerful, while being incredibly easy to work with complex data and DB relations. Most forms, even really complex forms with many fields and related resources, can be implemented almost entirely in declarative code models and YAML config files.

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      Netlify looks interesting and something like what I'm thinking of.

  • Casey Brooks
    Casey BrooksSep 11, 2018

    I don't trust generated code either in most cases. It's too easy for scaffolds to fall out of date or require a lot of work to make the generated code do the additional stuff you need.

    However, Java's annotation processing API is really nice for compile time code generation, so you know it is always up to date and works exactly as it should. Code generation that gets destroyed and recreated continually can be quite invaluable.

    In my opinion, code generation can work but it shouldn't be static generation, only done once. It should be part of your build process.

    • Pankaj
      PankajSep 11, 2018

      Is this dynamic code generation responsible for slower server start ups in spring boot? I'm learning spring boot right now and love it so far except for the slower server start ups.

  • Chris James
    Chris JamesSep 11, 2018

    Probably something you're not thinking about is the UX.

    Too often websites mirror their database in terms of "here is a CRUD form that maps around a table in our db". That's the way it is for a lot of websites but a lot of research is showing how it's poor UX

    Have a read about task based UIs. Rarely does someone want to read a form and edit one field, or two fields. They want to perform a meaningful business action which should have a specific form for it.

    The reason I mention this is that it probably doesn't fit too well in your model. Not to discourage you! You're right that a lot of websites are how you describe, but it would be great it if we could move away from that!

    Slight nitpick

    some middleware to do business/database

    "Middleware" generally should not be doing any business logic. I would not expect my middleware to be responsible for saving the form entries into databases.

    Good luck!

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      middleware is perhaps the wrong word. I mean the "middle layer"

      this:

      UI
      Everything in the middle
      Database

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      I mostly implement task based UIs at the day job, but baby steps. I'd rather see if there is interest in a framework that can be given a form and create a backend first, before a framework that can be given forms, and create a backend, and then manage the finite state machine inherent in task management.

  • Cameron
    CameronSep 11, 2018

    I'd need an easy and transparent way to access the generated API myself - for those sudden special requirements that don't work with defaults and weren't planned in - without damaging readability.
    Otherwise the framework would prove too inflexible for productive use and would fail fast

  • Charly S.
    Charly S.Sep 11, 2018

    It's always interesting to have code generation tools. I was thinking the other day about that. To connect to a database and generate UX and basic code. Lots of mistakes could be avoided. Did it in other languages before but for my own usage. Problem with what I've seen in the market is that they force you to use some functions of their own. I'd love to see what you come up with.

  • Muhammad Osama Arshad
    Muhammad Osama ArshadSep 11, 2018

    I've been making web forms and calculators for my clients for quite a while now. I think such a tool would be great. I would also be willing to chip in if possible.

    However, many clients require web forms that don't interface with a back-end, an example of this would be pricing calculators.

    Do you think your tool would be of help in such a case?

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      The tool I have in mind would not be useful in that case. For the case you are describing, I think a well made static website would be the best tool.

  • Kelly Copley
    Kelly CopleySep 11, 2018

    Seems strange and a little overly complicated to define your front end code and have your back end code generated from it instead of vise versa.

    This is especially the case when things like GraphQL or SimpleSchema allow you to define how your data should look on the backend and packages like uniforms take that definition and create your forms from that.

    • Casey Brooks
      Casey BrooksSep 11, 2018

      While this might not be the most efficient for developers, it could be huge for non-developer content managers. Imagine being able to build a website for a client, and they can manage forms with real, structured tables themselves without needing to go to the developers for every new form they need, and without resorting to "Form-builder" plugins which typically use key-value DB schemas for form submissions that are difficult to query or write reports for.

      • Gunnar Gissel
        Gunnar GisselSep 12, 2018

        That is who I'm thinking of. CMS folks, web designers, regular designers, people with a flowershop and a nephew who is 'good at computers'.

        Generating UIs from the backend typically involves a lot of fussing with yaml or xml or json in lots of different files and some light coding. Big steep slope to climb.

  • Jason Bradley
    Jason BradleySep 11, 2018

    The closest implementation I've seen to solving this type of challenge was utilizing Django + Django Rest Framework.

    After defining your models (docs.djangoproject.com/en/2.1/topi...) you can utilize the Django admin interface (docs.djangoproject.com/en/2.1/ref/...) for handling CRUD type behavior.

    On the API side you can rely on your previously generated models to build out a CRUD API.
    (django-rest-framework.org/api-guid...)

    You can also generate your web forms from the models as well.
    (docs.djangoproject.com/en/2.1/topi...)

    • Gunnar Gissel
      Gunnar GisselSep 12, 2018

      Django is close to what I'm talking about. Particularly their admin pages.

  • Casey Brooks
    Casey BrooksSep 11, 2018

    I'm not too familiar with Spring Boot, but code-gen would make the compilation step take longer, not the server startup. Java code generation libraries (such as Dagger and Butterknife which are common on Android) actually dramatically increase application startup times, because all the hard work has been done at compile-time.

    Taking Dagger as an example (dependency injection), the generated code doesn't require Reflection as a runtime-library would. It looks for @Inject annotations in your code, finds the @Modules which provide those dependencies, and writes new Java source files to create the object for you. Super fast, no reflection required. Spring Boot does runtime injection, and so uses Reflection to find the @Inject/@Autowired annotations, and then uses Reflection to call the constructor or set the fields as necessary, which is known to be slow. This is in addition to the many other things Spring is doing on server startup (classloading, resolving routes, connecting to databases, etc.).

    • Jan Wedel
      Jan WedelSep 14, 2018

      A spring boot app with 1000s of beans and component scanning still starts in 1-2 seconds. Most of the startup time is consumed when using Hibernate and flyway eg.

  • Gunnar Gissel
    Gunnar GisselSep 12, 2018

    Maybe I've spent too much time in the Java world with Spring and Hibernate, but I don't mind generated code. The main thing is to always be able to regenerate it, imho. Never modify it, and don't ask it to do anything it isn't designed for

  • Gunnar Gissel
    Gunnar GisselSep 12, 2018

    Thanks everyone for commenting, I really appreciate all the different perspectives and suggestions.

Add comment