• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Seeking Insights on HTMX: Advantages and Limitations Discussed in 'Modern Frontends with HTMX

 
Ranch Hand
Posts: 72
5
  • Number of slices to send:
    Optional 'thank-you' note:
Good morning everyone.

I'm reaching out to discuss the book "Modern Frontends with HTMX."

After watching several videos on HTMX, I found the technology quite intriguing.  My exploration into HTMX has been limited, partly due to a scarcity of in-depth resources, so I was thrilled to discover your book on the subject.  Thank you for contributing this valuable resource to the community.

I have a couple of questions that I hope you might shed some light on:

  • Could you outline the primary advantages of using HTMX over other frontend frameworks? I'm interested in understanding what makes HTMX stand out in specific scenarios or use cases.
  • Are there situations where HTMX might not be the optimal choice, and more traditional or alternative frameworks could provide better solutions? I'd appreciate insights into any limitations or considerations when deciding whether HTMX is the right tool for a project.


  • Thank you in advance for your time and insights.
     
    Author
    Posts: 22
    • Number of slices to send:
      Optional 'thank-you' note:
    Consider htmx as a server-first approach. The server generates HTML output, gives it to the client (via HTTP request or WebSocket), and the client "swaps" one or more existing HTML elements with the new HTML it received from the server.

    So that's the biggest difference compared to the approach we now use with most frameworks where API JSON is received from the server, and it needs to be handled on client side into a HTML structure.
     
    Saloon Keeper
    Posts: 7597
    177
    • Number of slices to send:
      Optional 'thank-you' note:
    Frank,

    since you mention swapping the contents of one element with another, is HTMX an SPA approach?
     
    Frank Delporte
    Author
    Posts: 22
    • Number of slices to send:
      Optional 'thank-you' note:
    Yes indeed, mainly SPA-approach. Or you swap elements on one page, and leave other buttons as links to new pages that again can have swaps with htmx for certain elements.
    As always with software... it depends (on your use-case)
     
    Albert Attard
    Ranch Hand
    Posts: 72
    5
    • Number of slices to send:
      Optional 'thank-you' note:
    Hello folks,

    First off, I'd like to express my gratitude for your insights so far.

    To my understanding, HTML has been the preferred format for data exchange between the server and the client when using HTMX.  For instance, if there's a need to display a list of items to the user, the server would typically format this information into HTML and send it over as such.

    I'm curious to gather your thoughts on this matter, especially in the context of how JSON has changed the interaction between the backend and frontend.  With JSON, the backend doesn't need to concern itself with how the data will be presented.  The same dataset (e.g., a JSON array of items) could be rendered in various ways by the frontend, such as an HTML list, table, or a collection of DIVs.  This separation seems to suggest a more decoupled architecture, where the backend is agnostic of the frontend's presentation logic.

    Sending data as HTML, on the other hand, implies a tighter coupling between the backend and frontend, as the backend pre-defines the presentation format.  I'm eager to understand your perspectives on this approach.  Does the advantage of using HTML for data exchange outweigh the flexibility and separation offered by JSON, or are there specific scenarios where one is clearly preferable over the other?

    I look forward to your thoughts and insights on this topic.
     
    Frank Delporte
    Author
    Posts: 22
    • Number of slices to send:
      Optional 'thank-you' note:
    Indeed the coupling is very strict, as in your example, the server returns a full ul-li-list or a single li-element to add to an existing ul-list. So full formatted HTML indeed.
    But be honest, in how many cases in your application is the exact same JSON-data used for different HTML-output?
    As in all cases, htmx is no replacement for all JSON or other data formats between client and server, but it can definitely simplify the client side in specific use cases.
    I see htmx as a perfect technology for a UI where certain elements need to be swapped with others, or items need to be added or removed from a list or table.
     
    Author
    Posts: 12
    5
    • 1
    • Number of slices to send:
      Optional 'thank-you' note:
    Hi,

    About HTML as data exchange format:

    "Sending data as HTML, on the other hand, implies a tighter coupling between the backend and frontend, as the backend pre-defines the presentation format. "

    In fact, the inverse is true. With a JSON format, your frontend needs to be built for the data that is sent as you are missing a lot of information in most JSON Data API's (usually called REST APIs). There is no information on the other endpoints you can call for example. So in most cases, there is some out-of-band knowledge needed on the (JavaScript) frontend to make everything work.

    With HTML, the full interaction is part of the HTML. There can be buttons and links in the HTML that allow further interaction, without the need of the client to know this. It just renders the HTML and everything works. There is no need to update 2 applications in lock-step.

    This also avoids problems around versioning the REST API. The server just returns the new "version"/html in case of server-side rendering and the browser renders it. With a Single Page Application, you need to make sure the frontend is updated to deal with the updated REST API.

    regards,

    Wim
     
    Albert Attard
    Ranch Hand
    Posts: 72
    5
    • Number of slices to send:
      Optional 'thank-you' note:
    Thank you all for your insightful contributions.

    I've been following our discussion closely and am now convinced to give HTMX a try.  It's clear there are numerous advantages to be explored, and I'm eager to see these benefits in action within my own projects.

    Diving deeper into a specific aspect of our conversation—versioning.  As we all know, managing versions in any distributed system can present its own set of challenges.  I'm curious if anyone here has personal anecdotes or experiences dealing with versioning, especially within the context of HTMX.

    To illustrate, let's consider a hypothetical scenario: a large application is deployed across hundreds of pods or containers, utilizing a ramped slow rollout strategy.  This process might take around 15 minutes to complete, during which users could be interacting with different versions of the application.  How have you navigated similar situations, or what strategies might you recommend to mitigate potential issues arising from such a scenario?

    I'm looking forward to hearing more of your stories and suggestions.  Your willingness to share has been invaluable, and I'm thankful for the knowledge exchange we've had so far.
     
    Wim Deblauwe
    Author
    Posts: 12
    5
    • Number of slices to send:
      Optional 'thank-you' note:
    Interesting question that maybe warrants its own topic on the forum here.

    For a non-rolling rollout case, htmx is easier regarding versioning. The server just sends the updated HTML to the browser. There is no chance that the old JavaScript application cannot talk to the updated server.

    Although, in all honesty, there are scenario's thinkable that your browser loads a page, and before htmx does a request to fetch an html snippet to swap, the server is updated and that call is either not possible anymore, or the returned html is not structured in a way that makes sense for the html that is already in the browser. In that case, the user will have to do a page refresh or you could always send a version number with all htmx requests and the server could check that. If it notices the version is different, it can force the browser to do a full-page refresh using the HX-Refresh header.

    However, for rolling rollouts, I am not sure, I have never had to work with them.
     
    Albert Attard
    Ranch Hand
    Posts: 72
    5
    • Number of slices to send:
      Optional 'thank-you' note:
    Thank you all for sharing your thoughts.  This has been very insightful.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic
    vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
    http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |