GeorgeB
Posts: 4
Joined: Fri Sep 13, 2019 8:24 pm

Local App vs Web App

Fri Sep 13, 2019 8:26 pm

I'm trying to build an info kiosk-like unit running on a raspberry pi, and I'm stuck on what should be the software deployed on it.

The app should be pretty simple: some windows with general info + some feed-back application(i.e. Do you like this part of the city?). It should have remote control(i.e change the information on the general info windows) and also some reporting on what was answered on the feed-back part:

Also, I'll be adding some extra features at some point in time, like ability to take a photo, and paying by card so an out-of-the-box solution doesn't make much sense.

The two solutions I've had looked into so far are:

- Local app running on Raspbian;
- Web app running in kiosk mode on Chromium (which is dependent on having an internet connection which might not always be the case).

I'm planning to hire a freelancer to write the code, but I'm not sure what to ask for(i.e. local app(maybe python/C++) or web app(JavaScript + CSS)). Not sure if any of the 2 will be more complex to develop, but the cost of the solution is something to take in consideration when selecting.

Thanks

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Fri Sep 13, 2019 10:43 pm

Sounds like a job for Electron: https://electronjs.org/

With Electron you have a web technology based way of creating applications, with all the usual HTML, CSS, WebGL etc. Continuous network connection not required.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Mon Sep 16, 2019 11:20 am

How long does it take to master a typical Node.js framework? I'm trying to estimate what I would charge a client if I have to eat learning these frameworks before getting started on what the client is paying me for.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Mon Sep 16, 2019 12:38 pm

No idea. I don''t use frameworks. What is a node.js "frame work" any way?

Well, except Express for creating web servers in the cloud. But I think you will find yourself using a "framework" to do that in pretty much any language. I believe even ScriptBasic has one.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Mon Sep 16, 2019 4:11 pm

So Electron isn't a framework?

ScriptBasic is a top down procedural language and has no frameworks to offer.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Mon Sep 16, 2019 4:45 pm

Might be. If Gtk is, or Qt, or XLib or ... I don't want to get into a quibble over the definition of "framework".

There is a lot to be said for such event driven systems though. Of which JS and node.js is one.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Mon Sep 16, 2019 6:43 pm

IUP is a library not a framework.

Frameworks are offsprings of the web evolution.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Mon Sep 16, 2019 10:13 pm

"Frameworks are offsprings of the web evolution."

No, they are not. Please do read some definitions and history of "framework" in computer science: for example. https://en.wikipedia.org/wiki/Software_framework

Things like Borland IDE's for Pascal and C++ provided frameworks, they were certainly not WEB tools and were created before most people had heard of the WEB.

The software architecture work on in in 1996 based on the PSOS operating system was a "framework" for creating embedded software in C.

The Lucol language I programmed avionic actuator controllers in before that was for sure a framework. Not that the term was common parlance then or at least not in those circles.

If you look at Linux/Unix device drivers I would argue they operate in a "framework".

Admittedly you are right, in those days most programmers were still stuck in the purely procedural world of structured programming, sequence, selection, iteration.

Show me a hello world dialog box with a button in ScriptBasic and I bet I can spot the "framework" in there :)
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Tue Sep 17, 2019 1:45 am

Heater wrote: Show me a hello world dialog box with a button in ScriptBasic and I bet I can spot the "framework" in there.

Code: Select all

DECLARE SUB FFI ALIAS "dyc" LIB "dyc"

FFI "ms,i,USER32.DLL,MessageBox,PZZL", 0, "Hello Heater!" & CHR(0), "ScriptBasic Framework", 0
Attachments
Hello_Heater.png
Hello_Heater.png (1.49 KiB) Viewed 1465 times

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Tue Sep 17, 2019 6:19 am

Very neat. I guess I get what I order. But bear with me for a minute...

Correct me if I'm wrong John but as far as I can tell in a typical ScriptBasic GUI application one Creates a Window:

Code: Select all

' Initialize IUP
Iup::Open()
 
' Create main window
 
win = Iup::Create("dialog")
  Iup::SetAttributes(win, "TITLE=\"ScriptBasic IUP Online Dictionary\", SIZE=500x300")
  Iup::SetCallback(win,"CLOSE_CB",ADDRESS(Win_exit()))
Then adds a bunch of Widgets to it:

Code: Select all

vbox = Iup::Create("vbox")
  Iup::SetAttributes(vbox, "MARGIN=10x10")
 
' Create server panel
 
topBox = Iup::Create("hbox")
  Iup::SetAttributes(topBox, "GAP=10")
  Iup::Append(vbox, topBox)
...
serverList = Iup::Create("list")
  Iup::SetAttributes(serverList, "EXPAND=YES, VISIBLELINES=1")
  Iup::Append(dictFrame, serverList)
  Iup::SetCallback(serverList, "ACTION", ADDRESS(serverList_selected()))
...
Then one defines a bunch of call back handlers for those widgets:

Code: Select all

...
SUB serverList_selected
  whichDictionary = Iup::GetListText()
END SUB
...
Then one starts the whole GUI system running:

Code: Select all

...
Iup::MainLoop()
Iup::Close()
END
At this point we have "inversion of control". That is to say, the GUI system takes over and calls the users code, the call backs/handlers, when GUI events happen. No longer do we have "top down procedural" execution as you stated above. This is the classic hallmark of a "framework". As described here: https://en.wikipedia.org/wiki/Software_framework. It looks very much like other GUI frameworks like Qt or anything done in Javascript in the browser or elsewhere.

Of course one can put up a simple box and a button like the one John shows above in a single line of code in many of these frameworks as well if one likes.

With that straight I think it's all I want to say about "frameworks".
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Tue Sep 17, 2019 10:38 am

You're correct.

If I want a native GUI, I would use the IUP library.

IUP takes care message processing and callbacks to SB.

GeorgeB
Posts: 4
Joined: Fri Sep 13, 2019 8:24 pm

Re: Local App vs Web App

Tue Sep 17, 2019 7:40 pm

Wow. A lot of answers. At the end I'm going with a local app on QT Designer which is currently driving me nuts. :roll:

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Tue Sep 17, 2019 7:41 pm

You should seriously look at IUP. Qt is a monster and tough to work with.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Wed Sep 18, 2019 4:34 am

GeorgeB,

I urge you to reconsider.

You have given your requirements as:

0) Developed by hired help.
1) Secure.
2) Simple.
3) Info display.
4) Some simple user input.
5) Remote info update.
6) Reporting of captured user input.

Future:

1) Take photos.
2) Card payments.

For once I agree with John. I love Qt but it is very complex and hard to use. It requires significant effort to master. As you say, it's driving you nuts. A lot of this is down to the complexity of Qt and GUI programming in general. A lot of it is down to having to use C++, a famously impossible to understand language.

If you think it's hard making the GUI in Qt wait till you start to add in all that networking and threads etc your will need to meet your requirements.

I put "Development by hired help" at the top of your requirements list on purpose. That dictates that you should use a language and system that is widely known and used and for which it is much easier and cheaper to hire such help. Now a days that implies web technologies, HTML, CSS, Javascript.

Development is one thing, future enhancement/maintenance is also to be considered. You don't want to be left with a pile of code by a developer that nobody else understands or wants to work on. That may lock you into your original developer and his price gouging and make it very hard to find an alternative to continue the work.

I also added "1) Secure" as this will be an unattended kiosk application no doubt communicating over the net. Again this suggests using web technologies where networking is a natural and security with HTTPS and such is catered for.

You will need a server somewhere for this thing to communicate with. For those remote updates and data collection. Not to mention general health/status monitoring. Again that sounds like a web technology thing.

Putting all this together suggests Electron as a front running option.
Memory in C++ is a leaky abstraction .

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Wed Sep 18, 2019 8:00 am

@Heater,

Cost wise, do you think it would be cheaper to do it as a web application rather than a desktop GUI?

How easy it to control hardware (camera, sound, credit card reader, ...) as a web app?

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Wed Sep 18, 2019 8:36 am

When you use Electron you are not creating a web application. You are creating a desktop application that happens to use a rendering engine and other technologies used in the Chrome web browser together with node.js.

Cost wise I have no idea except in my experience it's far easier/quicker to do these things in HTML/CSS/Webgl etc and Javascript than Qt and C++. As a result my company switched away from all it's C++/Qt development years ago.

Hardware control is not a problem. You are creating a desktop application that can access hardware as easily as using pretty much any language. Node.js has thousands of modules available. Serial ports, GPIO, SPI, camera, etc, etc are all catered for with available modules.
Memory in C++ is a leaky abstraction .

jalih
Posts: 94
Joined: Mon Apr 15, 2019 3:54 pm

Re: Local App vs Web App

Wed Sep 18, 2019 9:06 am

Heater wrote:
Wed Sep 18, 2019 8:36 am
When you use Electron you are not creating a web application. You are creating a desktop application that happens to use a rendering engine and other technologies used in the Chrome web browser together with node.js.
There are some security considerations when using Electron...

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Local App vs Web App

Wed Sep 18, 2019 10:13 am

jalih,
There are some security considerations when using Electron...
There are major security considerations in all applications and all languages/run times.

Especially when they require user input, network connectivity, remote update, etc. Even more especially as this is a kiosk style application that will run unattended in some public location (as far as I can tell).

The problem described in the linked article is nothing much. It requires that that the attacker already has read/write access to your file system. If that is the case you are are totally compromised already no matter what language or system you are using.

Aside: I find it odd that the author describes this as a Cross Site Scripting Attack (XSS). It most certainly is not that.

Thanks for the heads up though. It's always good to be reminded of what we are up against when creating such systems.
Memory in C++ is a leaky abstraction .

GeorgeB
Posts: 4
Joined: Fri Sep 13, 2019 8:24 pm

Re: Local App vs Web App

Wed Sep 18, 2019 3:28 pm

Heater wrote:
Wed Sep 18, 2019 4:34 am

I put "Development by hired help" at the top of your requirements list on purpose. That dictates that you should use a language and system that is widely known and used and for which it is much easier and cheaper to hire such help. Now a days that implies web technologies, HTML, CSS, Javascript.
Heater, really appreciate that you took your time to answer thoroughly.
Any idea on the number of hours needed if I go with an web app? Ballpark estimation is just fine.

Thanks again

GeorgeB
Posts: 4
Joined: Fri Sep 13, 2019 8:24 pm

Re: Local App vs Web App

Thu Sep 19, 2019 2:27 pm

Heater wrote:
Wed Sep 18, 2019 4:34 am
0) Developed by hired help.
1) Secure.
2) Simple.
3) Info display.
4) Some simple user input.
5) Remote info update.
6) Reporting of captured user input.

Future:

1) Take photos.
2) Card payments.
Am I overthinking it? Would it work if I just use WIX, or some other website builders, add a store with a POS plugin and add some pages with some custom JS behind. And them use Chromium in Kiosk mode to go to that site.

User avatar
John_Spikowski
Posts: 1608
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Local App vs Web App

Thu Sep 19, 2019 4:47 pm

I'm pretty happy using Shopify for my clients ecommerce sites.

Return to “General programming discussion”