Array in an array
#66
(03-03-2023, 02:59 AM)Balderdash Wrote: I think you might have missed me mentioning SQLite, which resides locally. Not as a networked database. And would actually be easier than trying to implement JSON, which is designed for object-oriented programming. Since all you need is a two dimension array, SQL is much easier. Also, the functions for SQL handle the data gathering for you. Tell me which is easier: Looping through a file yourself and trying to parse data with hand-written functions or using something that is used by many successful software products and when you want data, you just ask for it with very simple language and suddenly it's in your array.
Do
If....
If....
If....
If....
Loop Until....

OR

"SELECT * FROM myTable WHERE myColumn = 'myValue'"
For X = Lbound(DB_Results) to Ubound(DB_Results)
do something
do something else
Next

I really do not think you see how difficult managing JSON with QB64 will be. Sure, some poor soul might write up some 10,000 line library from scratch for doing it but the user experience will be absolute garbage. I've managed to use a bit of a JSON library in QB64 before but it was just a crappy experience and made me regret wasting the time on it.

The way you're describing working with JSON sounds a lot like my experiences with XML, and that user experience IS garbage. My experience with JSON objects was entirely different. To illustrate I'd need to sit down at the computer & write pseudocode for a proper example, but forget the If If loop until. That DOES suck! What I am talking about is more something like: 

Vacuum(MyHouse.Bedroom.Floor)
SearchRoom(MyHouse.Bedroom)
For pCount = lbound(Planets) to ubound(Planets)
    ThisPlanet = Planets(pCount)
    For pMoon = lbound(ThisPlanet.Moons) to ubound(ThisPlanet.Moons)
        ThisMoon = ThisPlanet.Moons(pMoon)
         If ThisMoon.Radius > MinSize and ThisMoon.Bases.Count < MaxBases Then blah blah

That's a lame example, but the point is that you aren't looping like in XML to find the property you're looking for, because you just use dot notation to directly access those properties. The programmer isn't "managing JSON" - that's done by a JSONify (deserialization) function one time, when you load it into memory. In fact, you don't even use JSON unless you're loading/saving persisted values. Different use case.

Hey, I don't need convincing on the value of SQL - in another life, I wrote T-SQL & PL/SQL sprocs every day as a part of my job, and I was quite fond of it. I just don't see SQL and JavaScript objects as competition for one another. JSON has its uses - including interoperability with REST services. How are you going to work with an object some http service sent back using SQL? Totally different tools for different jobs, with some overlap.

For me one issue with relying on SQLite is reliance on a 2nd product. Now the developer and their user have to download, install and set up a 2nd tool, so you might not be managing JSON (which needs no managing to begin with) but you're now managing a dependency, and moving away from the "one and done" simplicity that makes QB64/PE such a pleasure to use. 

But I don't want to poop all over SQL, it does have its merits and strengths. I'm just more of a mind to say why not both, and use whichever one fits the need? JSON type objects and relational databases each have their own strengths and uses. 

Let me back up a second though - you found a JSON library for QB64? Do tell!
Reply


Messages In This Thread
Array in an array - by NasaCow - 02-15-2023, 12:44 AM
RE: Array in an array - by bplus - 02-15-2023, 01:55 AM
RE: Array in an array - by OldMoses - 02-15-2023, 02:43 AM
RE: Array in an array - by NasaCow - 02-15-2023, 03:17 AM
RE: Array in an array - by OldMoses - 02-15-2023, 11:02 AM
RE: Array in an array - by mnrvovrfc - 02-15-2023, 03:53 AM
RE: Array in an array - by SMcNeill - 02-15-2023, 12:59 PM
RE: Array in an array - by bplus - 02-15-2023, 05:31 PM
RE: Array in an array - by bplus - 02-16-2023, 04:25 PM
RE: Array in an array - by NasaCow - 02-17-2023, 12:03 AM
RE: Array in an array - by SpriggsySpriggs - 02-17-2023, 05:43 PM
RE: Array in an array - by Kernelpanic - 02-18-2023, 03:49 PM
RE: Array in an array - by TempodiBasic - 03-11-2023, 02:59 AM
RE: Array in an array - by bplus - 02-17-2023, 06:32 PM
RE: Array in an array - by TerryRitchie - 02-17-2023, 09:12 PM
RE: Array in an array - by SMcNeill - 02-17-2023, 11:42 PM
RE: Array in an array - by madscijr - 02-28-2023, 07:14 AM
RE: Array in an array - by mnrvovrfc - 02-17-2023, 10:57 PM
RE: Array in an array - by TerryRitchie - 02-18-2023, 02:24 AM
RE: Array in an array - by AtomicSlaughter - 02-18-2023, 09:39 AM
RE: Array in an array - by bplus - 02-18-2023, 12:47 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 09:25 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 09:41 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 10:01 PM
RE: Array in an array - by Kernelpanic - 02-18-2023, 11:07 PM
RE: Array in an array - by TempodiBasic - 02-19-2023, 01:46 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 12:19 AM
RE: Array in an array - by bplus - 02-21-2023, 01:07 AM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 05:13 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 02:26 PM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 02:54 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 01:18 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 02:37 PM
RE: Array in an array - by bplus - 02-21-2023, 02:16 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 06:04 PM
RE: Array in an array - by bplus - 02-21-2023, 06:26 PM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 10:24 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 05:59 PM
RE: Array in an array - by bplus - 02-21-2023, 06:33 PM
RE: Array in an array - by bplus - 02-21-2023, 06:42 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 06:45 PM
RE: Array in an array - by bplus - 02-21-2023, 06:51 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 09:19 PM
RE: Array in an array - by bplus - 02-21-2023, 11:13 PM
RE: Array in an array - by TempodiBasic - 02-22-2023, 09:32 AM
RE: Array in an array - by Kernelpanic - 02-27-2023, 07:05 PM
RE: Array in an array - by Kernelpanic - 02-28-2023, 03:33 PM
RE: Array in an array - by madscijr - 02-28-2023, 06:24 PM
RE: Array in an array - by TempodiBasic - 03-11-2023, 02:23 PM
RE: Array in an array - by Kernelpanic - 02-28-2023, 11:14 PM
RE: Array in an array - by madscijr - 03-01-2023, 02:13 AM
RE: Array in an array - by mnrvovrfc - 03-01-2023, 03:29 AM
RE: Array in an array - by bplus - 03-01-2023, 04:00 PM
RE: Array in an array - by madscijr - 03-01-2023, 05:24 PM
RE: Array in an array - by Sprezzo - 03-02-2023, 08:34 AM
RE: Array in an array - by bplus - 03-02-2023, 05:18 PM
RE: Array in an array - by mnrvovrfc - 03-02-2023, 04:26 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 05:19 PM
RE: Array in an array - by bplus - 03-02-2023, 05:25 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 05:26 PM
RE: Array in an array - by bplus - 03-02-2023, 05:28 PM
RE: Array in an array - by Dimster - 03-02-2023, 06:05 PM
RE: Array in an array - by bplus - 03-02-2023, 06:20 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 07:12 PM
RE: Array in an array - by mnrvovrfc - 03-02-2023, 10:46 PM
RE: Array in an array - by madscijr - 03-03-2023, 12:47 AM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 02:59 AM
RE: Array in an array - by madscijr - 03-03-2023, 04:24 AM
RE: Array in an array - by mnrvovrfc - 03-03-2023, 07:22 AM
RE: Array in an array - by mnrvovrfc - 03-03-2023, 07:11 AM
RE: Array in an array - by vince - 03-03-2023, 10:07 AM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 01:02 PM
RE: Array in an array - by madscijr - 03-03-2023, 03:06 PM
RE: Array in an array - by vince - 03-03-2023, 03:17 PM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 03:25 PM
RE: Array in an array - by mnrvovrfc - 03-11-2023, 06:22 PM
RE: Array in an array - by NasaCow - 03-13-2023, 03:29 AM
RE: Array in an array - by TempodiBasic - 04-02-2023, 10:14 PM
RE: Array in an array - by NasaCow - 04-06-2023, 02:37 AM
RE: Array in an array - by TempodiBasic - 04-12-2023, 10:53 AM



Users browsing this thread: 1 Guest(s)