Recent

Author Topic: Mobile development - Android & iOS  (Read 38473 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Mobile development - Android & iOS
« Reply #45 on: December 09, 2021, 03:37:25 pm »
How many have custom applications made by SMB on them other than maybe games?

I think that's the really important thing, or possibly rephrased to include larger-scale corporates known to be using Delphi.

My own 'phones have the UK's COVID tracker app, GPS and smartwatch interfaces, and some network testing stuff... and that's about it as far as graphical apps are concerned.

I can certainly imagine using a tablet rather than a laptop for on-site device access... but even then the lack of a physical keyboard would make it less than attractive. Apart from that my use is mainly using SSH or VNC to access remote systems if I'm away from my office.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Blade

  • Full Member
  • ***
  • Posts: 177
Re: Mobile development - Android & iOS
« Reply #46 on: December 09, 2021, 06:35:08 pm »
Developing for iOS is more involved than Android as not only you need a macOS computer, but also an iOS device (both of which aren't necessarily cheap). For someone like me for example that would be quite an investment (as I use Linux/Windows and Android) thus I prefer to do that investment somewhere else instead.

Understand the situation.  Difficult to develop for hardware that one doesn't possess.  So, are you also saying that yourself or possibly other developers might need macOS and iOS devices provided or donated by the Lazarus community in order to actively support mobile development for iOS?  It appeared that Chronos made an offer (page 2), that maybe should be discussed with him by PM.

Nah, Windows is here to stay, it could be in some areas overtaken by Android, but in many domains there is no chance. One huge advatage of windows is that it is backwards compatible to the stone ages, so if you look for example into the critical infrastructure sector: Hospitals, Powerplants, etc. they are still using software from multiple decades ago and this is only possible because of Windows. Android is based on Linux, which is famous (well more the GLIBC rather than linux itself) to switch up abis to make it not backwards compatible.

While I agree that Windows will be with us for many years to come, a lot has to do with Microsoft's hold on being used in the business world (thanks to Microsoft Office).  But, let's not forget that Microsoft Office is in the cloud and are apps that can run on Android and iOS.  I do think the percentage of Windows OS dominance on the desktop and/or for general use will dwindle.  When it comes to personal computing, a lot of people are relying on their phone and have become used to Android and iOS apps.

Let's also not forget that Windows 11 can run Android apps.  Microsoft knows what's up, and wouldn't be doing such unless necessary.  By the way, for those that get pulled into Google's Chrome OS, the lure of running Android apps is a strong part of it.  I do think that at some point, with so many people already having Android phones and being used to it, a push will happen to move over to Android.  I know many people that simply own an Android phone for all their personal computing.  They touch Windows because their company gave them a laptop or tablet with it, and must use for work.

Even in the context of the work laptop or tablet, there is a strong push to put everything on the cloud (company secrets and security be damned).  In the cloud context, the hardware and OS could easily be some cheap Android, Linux, or even Chrome OS.  "Windows", as we know it, could become more like using another app or seen as something you have to log into because "forced to" for work or certain jobs.

Which of those IDES provide that? IOW which also leverage their prime native desktop solution on mobile ?

I didn't want to get into naming such, because don't want to promote others (and I prefer Object Pascal).  Various game engines provide the ability to develop apps on the desktop for Android and iOS.  An example is Solar2D (that has their own built-in simulator) in the Lua world (which comes with the limitations of scripting), which can be somewhat compared to the Castle Game Engine for Object Pascal.  Solar2D does have the advantages of at one time being commercial, before becoming open source.  Various game engines lend themselves towards also being useful for creating apps which are not just games.  Of course the baggage of a game engine would not be ideal for many developers, but that's a depends type of thing.  Another example is B4X, a Basic and Java hybrid, that somewhat compares to Delphi and Lazarus.  They provide a solution for both desktop and mobile development, but both Delphi and Lazarus are superior for desktop app creation in comparison.  They are a mix of freeware and payware.  Arguably, another downside to their approach is it's more of a soft transition into the Java world, whether the user realizes it or not.

I'm not saying that Lazarus should have a single comprehensive solution for both desktop and mobile development, but rather I'm making the case that it would be better that it did have a more advertised solution for iOS development or embrace mobile development.  Would like to see that there is some kind of recognized iOS solution, which would help public perception of Lazarus, and those that like Pascal and want to add mobile development along with doing so for desktops.

As I gave examples from Simon Choi's blog, iOS development with Free Pascal and Lazarus is clearly possible (in addition to game engines like Castle), but this is like something "under the table".  As it is, we have a recognized unofficial Android solution (LAMW/Laz4Android), so it looks quite "half way".  In addition, the comparison between Delphi and Lazarus is almost unavoidable, so there is no hiding that people will look at mobile along with desktop.  Lazarus has been and is associated with the expression, "write once, compile anywhere".
« Last Edit: December 09, 2021, 07:05:41 pm by Blade »

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Mobile development - Android & iOS
« Reply #47 on: December 09, 2021, 07:11:26 pm »
You are begging for a single GUI library solution here. Which of those IDES provide that? IOW which also leverage their prime native desktop solution on mobile ? Does MS support MFC on mobile? Does Delphi support VCL ?
Xamarin. Started of as a framework for supporting GUI applications using .Net Core for Windows, Linux and (I think) OSX, and later was expanded to also include mobile apps. Today it is part of Microsofts Visual Studio. And it is actually pretty successfull.

I didn't want to get into naming such, because don't want to promote others (and I prefer Object Pascal).  Various game engines provide the ability to develop apps on the desktop for Android and iOS.  An example is Solar2D (that has their own built-in simulator) in the Lua world (which comes with the limitations of scripting), which can be somewhat compared to the Castle Game Engine for Object Pascal.  Solar2D does have the advantages of at one time being commercial, before becoming open source.  Various game engines lend themselves towards also being useful for creating apps which are not just games.  Of course the baggage of a game engine would not be ideal for many developers, but that's a depends type of thing.  Another example is B4X, a Basic and Java hybrid, that somewhat compares to Delphi and Lazarus.  They provide a solution for both desktop and mobile development, but both Delphi and Lazarus are superior for desktop app creation in comparison.  They are a mix of freeware and payware.  Arguably, another downside to their approach is it's more of a soft transition into the Java world, whether the user realizes it or not.

As you are talking about game engines, another project on my never ending list of things I want to do somewhen when I have free time is to create a godot wrapper for pascal.
Bascially the godot game engine supports to write the game scripts in any language one likes by compiling it to a dynamic library which can be loaded by the game engine.
The FPC supports creating dynamic libraries for all major systems includion Android (this is for example how LAMW works by compiling your pascal code to a library that is loaded by the java interface) and I think also for iOS.
So this would be possible to use pascal to create cross platform games with godot.
« Last Edit: December 09, 2021, 07:13:08 pm by Warfley »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11455
  • FPC developer.
Re: Mobile development - Android & iOS
« Reply #48 on: December 09, 2021, 07:34:27 pm »
You are begging for a single GUI library solution here. Which of those IDES provide that? IOW which also leverage their prime native desktop solution on mobile ? Does MS support MFC on mobile? Does Delphi support VCL ?
Xamarin. Started of as a framework for supporting GUI applications using .Net Core for Windows, Linux and (I think) OSX, and later was expanded to also include mobile apps. Today it is part of Microsofts Visual Studio. And it is actually pretty successfull.

Xamarin is a rebranding of Monodevelop, it targeted Linux before Windows. One can discuss if it is a backport or not, but regardless of how you view it, Mono has had 15+ years of corporate stewardship (Suse/Novell and then Microsoft iirc).

If that is what it takes, we might as well stop now  ;)

But if you are nitpicking, it is not a major target that got extended to Mobile. (that would be .NET WPF). This is more a FMX, set up for portability and then backported to windows.

Various game engines lend themselves towards also being useful for creating apps which are not just games. 

What is their penetration? Is it on your grandma's phone? Does the butcher around the corner use it? Where is the audience ?

Quote
As you are talking about game engines, another project on my never ending list of things I want to do somewhen when I have free time is to create a godot wrapper for pascal.

I wasn't talking about game engines. I was asking for desktop projects that had an established native application platform, and then extended to e.g. mobile based on the same code base. (iow no different GUI library or other paradigm changed that forced to recode, otherwise we might as well argue that LAMW is it)
« Last Edit: December 09, 2021, 07:47:07 pm by marcov »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11455
  • FPC developer.
Re: Mobile development - Android & iOS
« Reply #49 on: December 09, 2021, 07:36:30 pm »
How many have custom applications made by SMB on them other than maybe games?

I think that's the really important thing, or possibly rephrased to include larger-scale corporates known to be using Delphi.

That is one thing to take away from that beast of a post. The other key one is that hybrid approaches might not be well accepted in e.g. stores in the first place.

Finally the third truth is that even if you agree on the target(e.g. VCL apps on mobile), the route to it is a problem too. If it takes too long, the mobile world might already fundamentally changed before it is ready.

And then there is of course the final blow to any feature discussion: Who is going to do it?
« Last Edit: December 09, 2021, 07:46:01 pm by marcov »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Mobile development - Android & iOS
« Reply #50 on: December 09, 2021, 07:49:54 pm »
Finally the third truth is that even if you agree on the target(e.g. VCL apps on mobile), the route to it is a problem too. If it takes too long, the mobile world might already fundamentally changed before it is ready.

That's interesting- and scary. Slightly earlier in the thread somebody suggested that Windows had largely stagnated with stable APIs etc.: will the mobile APIs similarly stabilise, or are there quite simply too many people working on them with too many different approaches for that to ever happen?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Mobile development - Android & iOS
« Reply #51 on: December 09, 2021, 07:59:25 pm »
Xamarin is a rebranding of Monodevelop, it targeted Linux before Windows. One can discuss if it is a backport or not, but regardless of how you view it, Mono has had 15+ years of corporate stewardship (Suse/Novell and then Microsoft iirc).
Not quite Monodevelop used GTK# for Forms. It then added the Xamarin GUI framework as an alternative to GTK#. This was the framework I was talking about, not the IDE. Later the IDE was rebranded Xamarin and later again it was bought my MS and incorporated into VS.

And the framework wasn't so long lived. This was the hot new stuff when I was using .Net I don't remember exactly when but probably so 2012ish or so and it only took a few years until they started with their mobile solution and it took of quite fast.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11455
  • FPC developer.
Re: Mobile development - Android & iOS
« Reply #52 on: December 09, 2021, 08:52:20 pm »
Finally the third truth is that even if you agree on the target(e.g. VCL apps on mobile), the route to it is a problem too. If it takes too long, the mobile world might already fundamentally changed before it is ready.

That's interesting- and scary. Slightly earlier in the thread somebody suggested that Windows had largely stagnated with stable APIs etc.

Stagnated sounds like it is a bad thing. IMHO it is something to strive for.

Quote
will the mobile APIs similarly stabilise, or are there quite simply too many people working on them with too many different approaches for that to ever happen?

I think there is simply no motivation to do so. That is also why e.g. Linux never developed stable applications APIs, as most applications are in servers, and Linux desktop is mostly for the hobbyist and a few power users and academics.

APIs are used as vehicles for platforms, which are as quickly abandoned  or mutated for the next best thing as they were created. I don't see any change coming short term in this, the driving force to bring about such change is simply not there, and life cycles are still shortening.
« Last Edit: December 09, 2021, 09:01:23 pm by marcov »

Chronos

  • Full Member
  • ***
  • Posts: 241
    • PascalClassLibrary
Re: Mobile development - Android & iOS
« Reply #53 on: December 09, 2021, 10:05:48 pm »
In summary, I don't see a practical route to something like that. We can't develop fast enough, and the solution will require permanent heavy duty maintenance to keep up with the yearly iterations. Moreover we already have a shortage of interested developers for even the rock bottom solution (customdrawn/lamw, the latter which is the labour of love of one developer).

I can be wrong of course. Maybe one of you has a 10 person team in his pocket just chomping at the bits to contribute :-)

Well then, perhaps you don't see it because you are blind to new approaches :) I think we don't really need those kind of comments here. I saw them over years too many times. Sure, everything is hard, too time consuming or even impossible. We already know that. Let's discuss how to overcome those obstacles and weight various strategies to solve the problem. Let it be just open discussion with new ideas or revised old ideas. Everybody tried to tell to Elon Musk that it is impossible to start a new car company or to start new rocket factory. https://www.youtube.com/watch?v=k9zTr2MAFRg

Back to the topic. Mobile platform is used more than desktop now and your numbers may vary but that is the fact https://gs.statcounter.com/platform-market-share/desktop-mobile-tablet Sure it depends if one is interested in mobile "market" or not. As I use my Android device daily, I really want to use my own applications or other open source applications which are available for desktop also on my phone. Sure, we can discuss many years about GUI differences between desktop, mobile and web. Every technology has own specifics and pros and cons. I even want to target Smart TV as a platform. We have Android TV at our home and I can't simply create an application for that TV using Lazarus/FPC. There are some alternative ways. I tried to use LAMW before and that is not the way how we want to develop application for all those platforms. At least not in direct and unified way. With Delphi FMX you can create mobile and desktop app with single code base. There will always be some platform specific things but normally it should be pretty easily possible. Delphi is kind of expensive and doesn't run on Linux so it is not an option for me.

And even it that would not be single application for those platforms, still Lazarus as IDE should offer ways to create mobile, desktop, web, console, tv, car, e.g. as separate applications. Just imagine an dialog window called "New project" where you can select needed GUI layout or possibly select generic dynamic layout. This ideal thinking is more like from top to bottom. That is the premise. To have development environment to allow develop an application/service/library/tool for any platform and GUI layout. That is where we can get in some distant future.

Back to reality. How can Android application be currently created? By quick check of existing Android related wiki pages https://wiki.freepascal.org/Portal:Android I can say that it is quite a mess. A lot of long and some outdated tutorials with many manual steps and auxiliary GUI tools to do a simple thing. To build GUI application. Can it be as simple as creation of a new project and hitting F9 to run in Android emulator? Or without emulator at least to simply compile and create Android package apk. Also you may need trunk FPC or Lazarus, anything can break and will probably break. Upgrade to newer Lazarus and FPC will probably break everything and one will need to do that again. Does it look like only to me as a big waste of time? Would it be better to start implementing partial Android/mobile support directly into IDE? Perhaps as an experimental feature which can be activated from somewhere. Sure, I can answer this by myself, this would take too much effort and there are no volunteers, so whatever.

Ok, Lazarus IDE can't support Android directly so what are other options apart from LAMW and other obscure ways described on wiki?
  • Implement Delphi compatible FMX framework for FPC. After all, Delphi needed to solve the same problem. VCL was too Windows oriented and they could either break VCL compatibility to extended it to be usable across new platforms or to create(or buy) completely new more modern GUI framework. For sake of existing customers they decided to go with new framework. So in case of Lazarus and LCL this decision still needs to be done.
  • Develop desktop app in Lazarus and mobile variant for Android and iOS in Delphi. How to sync GUI between those two environments? That is the tricky part. Perhaps one can create some Lazarus LCL to Delphi FMX converters. Or create LCL backend to target FMX as widgetset.
  • Another way to solve this would be to create some cross-compiler or better say transpiler to convert pascal code into code of other platforms which support Android/iOS. It may be Java, Kotlin, C++ or something else. This may not be just about language but also about GUI frameworks. That would be pretty complex and time consuming task but it is possible.
  • Create complete new more modern Object Pascal/Delphi compiler to target multiple platforms. Indeed, not and easy task. But still one of way to achieve that. Over the years there were many Pascal compilers developed and new are still created to some degree. One example would be https://wiki.freepascal.org/Projects_using_Lazarus_-_Developer_utilities#PicPas which supports only limited pascal syntax and no GUI design support, but it is still pascal compiler. The list of other compilers https://pascal.fandom.com/wiki/List_of_compilers_and_interpreters
  • Stop using Pascal and use different better tool to create mobile/desktop application. One interesting open source project is Haxe https://haxe.org/use-cases/ which can also target desktop and mobile platforms. Although still not ideal. There are so many technologies which tries to solve that multi-platform problem. Mobile apps can be developed with C#/.NET, Python, JavaScript and many others. I am not aware of any what would fulfill all my needs. So I am still using Lazarus.
  • Use Linux phone instead of Android. Linux phones are still slow, not fully functional, not widely available and they are expensive. But this may change in future. https://www.pine64.org/pinephonepro/

I understand that there are many other Lazarus weak areas like to this date not implemented single window docked IDE like Delphi has (AnchorDocking is just a poor guy alternative). Also Gtk3, Gtk4, Qt5 or whatever new toolkit version not fully supported. This is never ending effort to catch up with upcoming technologies and ever changing world. But this topic is about Mobile development and in this regard Lazarus is lacking.

We are just community of users so we can try to solve things in our way. We are glad for all work done on Lazarus and we thank to all involved core developers for their effort.
To all, feel free to post your constructive opinion and ideas how to solve this issue.
« Last Edit: December 09, 2021, 10:30:02 pm by Chronos »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Mobile development - Android & iOS
« Reply #54 on: December 09, 2021, 10:28:28 pm »
I think Chronos has summed the situation up fairly well. If nothing else, the community needs definite feedback from the Lazarus team as to what they consider to be the leading or at least viable approaches to the problem.

And the wiki urgently needs to be cleaned up to reflect that consensus.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2023
  • Former Delphi 1-7, 10.2 user
Re: Mobile development - Android & iOS
« Reply #55 on: December 09, 2021, 11:14:49 pm »
When I retitled and split this thread off from the original, I should probably have added iPadOS to the title. A lot of acquaintances in my older age group have forsaken computers altogether and, while most have mobile phones, it is tablets that have been filling the gap.

How many have custom applications made by SMB on them other than maybe games?

If I inventory my iPad added apps: Kindle, Google Maps, Weather (SMB), TramTracker (SMB) , TV Catchup x5 (SMB?), Termius (SMB), Flight Radar (SMB), Google Earth, Local Library eBook service (was Zinio, then RB digital, now Libby), Ping (SMB), Zoom, AdBlock (SMB), ONO (UNO card game - SMB).

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Mobile development - Android & iOS
« Reply #56 on: December 10, 2021, 02:06:48 am »
Everybody tried to tell to Elon Musk that it is impossible to start a new car company or to start new rocket factory. https://www.youtube.com/watch?v=k9zTr2MAFRg
A bit off topic, but Musk didn't start any of these companies, he bought them.

But let's go to the meat of your post:

  • Implement Delphi compatible FMX framework for FPC. After all, Delphi needed to solve the same problem. VCL was too Windows oriented and they could either break VCL compatibility to extended it to be usable across new platforms or to create(or buy) completely new more modern GUI framework. For sake of existing customers they decided to go with new framework. So in case of Lazarus and LCL this decision still needs to be done.
If you make it delphi compatible, you repeat the same mistakes Delphi made. I already said why I think Firemonkey is not a good solution, but to reiterate just one point. Most modern frameworks use CSS for styling like QT, JavaFX or Xamarin. CSS is powerful, well designed (by an expert comittee) and refined over multiple decades, and it is well known. There are much more resources available than for Firemonkey. If you need a special style, chances are there already exist CSS style sheets for that somewhere on the web.
Firemonkey is not that well designed, pretty hard to learn and has a community not nearly as large as CSS. Don't try to reinvent the wheel. To go to your Musk analogy, the SpaceX Falcon 9 does not really use new concepts. The concept of a reusable rocket that does a belly flop to land on it's back is an approach already developed by NASA a few decades ago, and simply combines it with modern engineering techniques, materials and computational power that wasn't available back then to make it feasable.
Take good existing ideas and embrace them, don't try to make your own thing if there are already solutions out there.

  • Develop desktop app in Lazarus and mobile variant for Android and iOS in Delphi. How to sync GUI between those two environments? That is the tricky part. Perhaps one can create some Lazarus LCL to Delphi FMX converters. Or create LCL backend to target FMX as widgetset.
Then you can ask yourself the question, if I am already paying 150€/month to use delphi, why should I use Lazarus in the first place? One reason that I think is why many people use Lazarus is because they believe Delphi is not worth that money.
  • Another way to solve this would be to create some cross-compiler or better say transpiler to convert pascal code into code of other platforms which support Android/iOS. It may be Java, Kotlin, C++ or something else. This may not be just about language but also about GUI frameworks. That would be pretty complex and time consuming task but it is possible.
There is already Pas2JS which you can use with Cordova to create cross platform apps. Also LAMW works in a similar way, it basically auto-generates a Java GUI which communicates with a pascal backend. So all the GUI stuff is autogenerated Java.
You misunderstand the problem the compiler (the FPC) already does fully support iOS and Android development. It's a library problem, that there is no GUI library available. There is absolutely no reason why a new compiler would be needed.
  • Use Linux phone instead of Android. Linux phones are still slow, not fully functional, not widely available and they are expensive. But this may change in future. https://www.pine64.org/pinephonepro/
I actually used different Linux systems phones multiple times. I even bought used phones specifically for testing out different systems. They are completely unusable at the moment. I've found the best usability was to have another phone you can use to ssh into them to use the Linux phone.
This is a completely non solution, because maybe then you are able to develop for your phone, but that phone not being usable also makes your apps unusable

Generally, I think we should try to get a solution to this problem. I know that most people might not have the time or proficiency to do any development in these areas, but one solution might be to utilize the already existing Free Pascal and Lazarus foundation to collect donations for the implementation of such a project.
For example in your list above you mentioned using a transpiler. Well there is actually currently a project for integrating electron app development into Lazarus using pas2js: https://foundation.freepascal.org/projects/thread-pool-implementation
Electron works well on all major platforms, including mobile, so this is an effort theoretically anyone could support even without the corresponding skills and time.

Personally when participating in this discussion I looked a bit into the widgetset system and how such a thing would be implemented. And I had a new idea, which I just added to my pile of project ideas, to create an LCL widgetset based on a browser interface. Where the Pascal app connects to a javascript client in the browser via websockets and gets notified about events over this channel and can instruct the javascript to update the browser.
With a first glance at how widgetsets are implemented this does not seem so complex, at least creating a small proof of concept whith only a limited number of controls and supported events.
Such a solution could be deployed as an android or iOS app using a browser frontend and the Pascal app compiled as dynamic library in the backend. Maybe, when I have some free time at the end of this year, I might come around to try and do this.
« Last Edit: December 10, 2021, 02:08:22 am by Warfley »

malcome

  • Jr. Member
  • **
  • Posts: 80
Re: Mobile development - Android & iOS
« Reply #57 on: December 10, 2021, 03:19:55 am »
Will you challenge to fight the Flutter created by Google?
I want the hot reload like Flutter! That is awesome.

Blade

  • Full Member
  • ***
  • Posts: 177
Re: Mobile development - Android & iOS
« Reply #58 on: December 10, 2021, 04:47:02 am »
Will you challenge to fight the Flutter created by Google?

I alluded to this in a previous post, as to what Google was doing with some of their "pet" languages, but the "cat is out of the bag" on this.  Flutter is another one, that can do desktop and mobile development.  They appear to have taken the custom drawn approach, and that's worked for them.

If you make it delphi compatible, you repeat the same mistakes Delphi made. I already said why I think Firemonkey is not a good solution...

Google's Flutter took a different route, and it's working for them. 

As for Delphi's FireMonkey, have to strongly disagree with your assessment.  FireMonkey has been arguably a success for Delphi or at least it can be acknowledged as a good move by them to use as a mobile solution.  It put them very much into the mix of mobile app creation.  Delphi's true issue with FireMonkey is they bought it from somebody else, versus creating it in-house, thus they had to shoehorn it into their existing product.  The Lazarus team have the advantage of "20/20 hindsight", so can correct mistakes that FireMonkey has made, in addition to if they went that route then it would be their in-house solution that they developed.  What they would create, would likely more smoothly fit the Lazarus IDE and ways of doing things.

Delphi is part of the larger Pascal community.  It will be mostly Pascal users and supporters that will likely be using Lazarus, so will be wanting the Pascal language to be in the forefront of possible solutions on mobile platforms.

Quote
There is already Pas2JS which you can use with Cordova to create cross platform apps. Also LAMW works in a similar way, it basically auto-generates a Java GUI which communicates with a pascal backend. So all the GUI stuff is autogenerated Java.

Here, I'm in agreement with you that creating Pascal to "other language" transpilers are a viable solution.  But, an essential point about this is that Pascal is the 1st class citizen, and that the transpiler is for leveraging existing knowledge and code to extend capabilities.

Cordova and PhoneGap are not attractive to many, which is why Smart Pascal has arguably stumbled.  It's not ideal to be relying on 3rd party solutions to get us the end goal of creating a mobile app versus more directly using Pascal and Lazarus to achieve that goal.  Other solutions in various programing languages/IDEs (Lua, Flutter, C#, B4X, Delphi, etc...) are providing solutions with their language and IDE to get on mobile platforms.

Quote
...create an LCL widgetset based on a browser interface. Where the Pascal app connects to a javascript client in the browser via websockets and gets notified about events over this channel and can instruct the javascript to update the browser...

Arguably, the JavaScript/HTML/CSS/browser route is best suited for web developers heavily involved and invested in that world.  And, there is an avenue for creating HTML5 applications already, which is Pas2JS or Smart Pascal.  That there is more that can be done with Pas2JS, I very much agree.  Not against web technologies, just saying that it's a different perspective for a desktop programming language to specifically make use of it when adding to what they are doing, versus being a web developer of that world where JavaScript is the primary language and are seeking to extend it's reach from browsers to desktop and mobile.

It could be said that a more "Pascal way" would be to target the OS directly for mobile app creation.  Keep in mind that this philosophy, and being closer to the metal, can extend to other lesser known OSes, hardware, robotics, etc...  It would be more aligned to the already existing ways to create desktop Lazarus applications for Windows, Linux, and macOS.  You are then leveraging the existing IDE and know how to create an app for Android and iOS.  When the Free Pascal and Lazarus community are bringing newbies and beginners in, it's to teach them Object Pascal and what they can do with it, not to undermine or pollute that path with other vastly different languages, contradictory approaches, or force them to rely on 3rd party solutions that has nothing to do with and no connection to Lazarus.
« Last Edit: December 10, 2021, 05:26:20 am by Blade »

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Mobile development - Android & iOS
« Reply #59 on: December 10, 2021, 07:30:48 am »
Oddly, nick1965's complaint about trying to use Lazarus for Android has a small bit of legitimacy.  Don't get me wrong, in no way am I excusing being rude or a user not taking the time to read help documentation (including wiki).  The angle that I'm talking about has to deal with expectations, and arguably the Lazarus team should be aware of such.  Ignoring that people would want to develop mobile applications for Android and iOS is strange.  Delphi has positioned itself where it's not just for the desktop, but also for mobile.  People who would be looking at Lazarus as a potential alternative, would obviously be considering this when making comparisons and decisions.
I don't want to blame anybody, but unfortunately this isn't about FPC/Lazarus only, but about whole open source. It's hobby for maintainers and they think about their own goals only - they don't accept requests from other people. And that's, what paid companies usually do - they want to satisfy as many clients, as possible. If you need something - you should do it yourself. I personally don't like it and also think, that it's real reason, why open source stagnates. Because it's obvious, that it would be much easier for maintainer, who already has lots of experience in developing this project, to implement required changes. And it would be counter-productive for me to learn everything about project from scratch to implement my own changes. Yeah, old version of Delphi has some limitations and even bugs. But it isn't worth it for me to start learning everything about FPC/Lazarus development in order to add several missing features to it. Not everybody, who needs to just hammer a nail, should know everything about making hammers.

Current FPC problems:
1) Closures. They're callbacks with arbitrary data, bound to them. Overall if one wants to pass arbitrary data to callback - he needs to declare structure or object and pass pointer to it to callback. Or implement it via interface. But it just lot of extra work, that makes code less readable. Closures solve this problem. They're actually just syntax sugar around "procedure/function of interface". My project has over 11k test cases. Massive amount of work has been required to implement them. Therefore their code should have been as minimal, as possible. Rewriting this code using ordinal callbacks or interfaces would result in 2..3x project code bloating.
2) Project groups. They aren't about bath compiling only. They provide shared compiling, project options and debugging. They're very useful, when one has solid project, but it's split into several modules.
3) Runtime packages. They are similar to C++ runtime. Delphi/Lazarus project are so huge exactly because each module contains it's own copy of all packages, it requires. Example: size of my project without runtime packages - 55Mb, with runtime packages - 36Mb, including 15Mb of shared packages, i.e. project itself - is just 11Mb. More modules project has - bigger difference is.

Not FPC problem, but Delphi problem, that encourages me to migrate to Lazarus:

Problems with implementing several interfaces via same object without using crutches like aggregated and delegated objects, that bloat code and waste memory. I use interfaces to avoid multiple inheritance problem, that would be "natural" solution. I really hate to use crutches to avoid language limitation. Programming language should be like IRL language. Everything should be expressed naturally. Unnatural constructions break your brain and waste your time. That's why script languages are becoming more and more popular today, despite of being slow and wasting memory.

This one is allowed in Delphi:
Code: Pascal  [Select][+][-]
  1.   TMyInterface = interface
  2.     procedure DoSomething(I:Integer);overload;
  3.     procedure DoSomething(S:String);overload;
  4.   end;
  5.  
  6.   TMyObject = class(TInterfacedObject, TMyInterface)
  7.     procedure DoSomething(I:Integer);overload;
  8.     procedure DoSomething(S:String);overload;
  9.   end;  
  10.  
If I remember correctly, this one isn't allowed:
Code: Pascal  [Select][+][-]
  1.   TMyInterface = interface
  2.     procedure DoSomething(I:Integer);overload;
  3.     procedure DoSomething(S:String);overload;
  4.   end;
  5.  
  6.   TMyInterface1 = interface(TMyInterface)
  7.   end;
  8.  
  9.   TMyInterface2 = interface(TMyInterface)
  10.   end;
  11.  
  12.   TMyObject = class(TInterfacedObject, TMyInterface1, TMyInterface2)
  13.     procedure DoSomething1(I:Integer);overload;
  14.     procedure DoSomething1(S:String);overload;
  15.     procedure TMyInterface1.DoSomething = DoSomething1;
  16.     procedure DoSomething2(I:Integer);overload;
  17.     procedure DoSomething2(S:String);overload;
  18.     procedure TMyInterface2.DoSomething = DoSomething2;
  19.   end;  
  20.  
And even if I don't use overloading, some bugs sometimes happen in Delphi, when it complains about missing method implementations, if project is recompiled - not rebuilt.

I would also implement some other features, related to multiple inheritance and virtual runtime object assembling, but they aren't necessary for now.
« Last Edit: December 10, 2021, 08:20:39 am by Mr.Madguy »
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

 

TinyPortal © 2005-2018