Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Web application framework and Smartphone apps

by bliako (Monsignor)
on Apr 05, 2021 at 21:50 UTC ( [id://11130863]=note: print w/replies, xml ) Need Help??


in reply to Web application framework and Smartphone apps

will the apps running on Android or iOS be expecting to communicate with the "hub" in JSON over RESTful URLs?

If JSON is a standard for REST I don't know, but both ends *can be made* to communicate with anything you want. JSON is convenient (except that you must url-encode it and you send binary data only as base64-et-al). Surely Perl backend can convert a JSON to a Perl data structure very easily. And vice versa. The client-app will coerce you to using a library for converting that JSON to objects (for example Gson) but you don't have to as you can have it converted to polymorphic hashtables. So, yes JSON is convenient on both sides. And an app, from personal experience, gains greatly by RESTing with JSON. I found Retrofit library useful for communicating with a server. If you are programming the app, your biggest problem will be placing all data requests using asynchronous logic. And that leads you to RxJava (for example). And that's some learning curve. Alternatively, you have a WebView component. Basically a browser inside your app, just a shortcut with lots of deadends.

  • Comment on Re: Web application framework and Smartphone apps

Replies are listed 'Best First'.
Re^2: Web application framework and Smartphone apps
by monx663 (Sexton) on Apr 05, 2021 at 23:02 UTC
    Thanks, Bliako.

    I don't much care about what will be used for handling the RESTful communication on the client side.
    I am primarily concerned with adding "base class" functionality to my systems' packages, that will help all relevant web objects to be used by smartphone apps as easily as they are by web browsers. Regarding JSON and Perl, I have already implemented base class functionality that gives objects the ability to JSON serialize themselves using the Mojolicious JSON functions.

      Do you see this "base class" functionality as exclusively producing JSON which is then either 1) sent straight to REST clients or 2) passed into an HTML-producing layer like: Templates+JSON=HTML to be sent to html clients (browser)?

        Good question, Bliako.

        To be honest I am writing stuff even as we chat here. As I wrote earlier about this web app framework of ours, it is very well written and adheres to design principles (MVC) typically seen only in well structured languages such as C++ and Java. It's not a bunch of scripts patched together with sticky tape! lol

        There's 63 "browser enabled" packages or web objects, yet there's only one "script" (controller) that pulls the relevant ones and delegates work to them.
        Additionally, it's mod_perl compatible, so responses can be instant as if things were running in an application server. :p
        Certain virtual class implementation code is pulled out of the database and ran on the fly. As a result, the JSON import/export code will probably be implemented in some sort of a class attribute serialization package, which most web objects can invoke through whatever method. This actually already happens with two base packages/classes which are responsible for "drawing" web objects to browsers and serializing them in and out of the database.

        The biggest problem is that I no longer love to code as much as I used to! :(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130863]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found