Object & JSON Support – Parse JSON strings into a jBASE, debug applications quicker and enhance support application with Dynamic Objects

New Features in jBASE 5.7
Dynamic Objects
Affectionately known as “JabbaScript”—jBASE 5.7 marries the language of MultiValue (BASIC) with a modern language similar to JavaScript, giving developers the best of both worlds. One of the main benefit of Dynamic Object is that it makes BASIC a true object-oriented language. Also, since the jBASE compiler produces native code, operations on dynamic objects are blazingly fast.
Dynamic Files
As the name implies, the new files are dynamic, built from the ground up to continually work optimally as updates are made. They aren’t like traditional MultiValue files which are hashed files that get re-sized manually or in the background. Dynamic Files reduce administrative overhead and boost your application’s performance.
- Use of memory maps. A memory map is where you do a one-off system call and this returns a memory pointer to file cache. This means that when accessing a file, instead of using the traditional call to the read() or write() function, which involve a system call, we simply access memory. There are restrictions and limitations to how much we can use this, but the overall effect is that we do fewer calls to read() and write() and hence fewer system calls.
- Group locking. These locks are transient, sometimes for less than a microsecond, and protect the internal integrity of the database during CRUD operations. They should not be confused with any other sort of locking we perform , for example read locks initiated by READU are something very different. In the past, we have used a locking type which involved a system call. We now use a memory based locking scheme that only requires a system call if the lock is busy.
Profiles
Profiles completely eliminates the necessity of using environment variables to configure jBASE by placing the entire configuration in a JSON file. In release 5.7, you can use either environment variables or profiles or a combination. The profile extends jBASE configuration allowing new settings which have never been available before. Also, 5.7 includes a new “zero configuration” mode that allows jBASE to run with zero external configuration.
RESTful Services
As a universal way for applications to communicate with each other, every major development language now includes frameworks for building RESTful Services. Native RESTful Services are built into jBASE allowing you to bypass proprietary APIs and open your Pick application to any language environment, web service or application.
Object Oriented Programming for PICK
Discover jBASE Dynamic Objects (jDO), an enhancement to the BASIC programming language. Dynamic Objects adds familiar mechanisms of Object-Oriented programming such as objects, methods, and classes expanding the functionality of any jBASE program. jDO is also not an ‘all-or-nothing’ approach to extending new or existing business logic as you can seamlessly inject as much or as little Object-Oriented code right alongside traditional BASIC. This allows a great amount of flexibility without being concerned with forklift-refactoring efforts. New Object-Oriented additions to the business logic become highly reusable and over-time your application will see faster implementation time with increased durability.
With jDO, there are built-in static methods available right out of the box like serializing/deserializing JSON strings to data objects. This brings an entirely new speed to application development while interfacing with the REST APIs out in the world. Here are some examples of working with jDO
$options jabba
RESULT.OBJ = NEW OBJECT; * build new object
OPEN "NW.ORDERS" TO FI.NW.ORDERS ELSE STOP "No orders file"
RESULT.OBJ->records = NEW ARRAY; * add an array called results inside result object
EXECUTE "SSELECT NW.ORDERS BY-DSND ORDERDATE"
CNTR=0
LOOP
READNEXT ID ELSE EXIT
CNTR+=1
READ ORDER FROM FI.NW.ORDERS, ID ELSE CONTINUE
ORDER.OBJ = NEW OBJECT; * build temporary object for this order
ORDER.OBJ->orderid = ID
ORDER.OBJ->customerid = ORDER<1>
ORDER.OBJ->employeeid = ORDER<2>
ORDER.OBJ->orderdate = OCONV(ORDER<3>,"D4-")
NUMBER.ITEMS=DCOUNT(ORDER<10>,@VM); * count how many order lines we have
ORDER.OBJ->items = NEW ARRAY; * add an array inside our order boject called items
FOR V=1 TO NUMBER.ITEMS
ITEMS.OBJ = NEW OBJECT; * temporary object for a single line item
ITEMS.OBJ->productid = ORDER<10,V>
ITEMS.OBJ->unitprice = OCONV(ORDER<11,V>,"MD2")
ITEMS.OBJ->quantity = ORDER<12,V>
ORDER.OBJ->items->$append(ITEMS.OBJ); * append our item detal into our order items array
NEXT V
RESULT.OBJ->records->$append(ORDER.OBJ); * append our order into our records array
REPEAT
PRINT RESULT.OBJ->$tojson(1); * print our output to json
We can read it into a jBASE Dynamic Object, print the name, update the name and display the resultant JSON simply as follows. It is to manipulate a Dynamic Object created from a JSON string with constructs such as ‘print myobj->name’ – –
jsh Z2018 ~ -->BASIC BP NWORDERS.EXAMPLE
NWORDERS.EXAMPLE
BASIC_1.c
Source file NWORDERS.EXAMPLE compiled successfully
jsh Z2018 ~ -->CATALOG BP NWORDERS.EXAMPLE
NWORDERS.EXAMPLE
Object NWORDERS.EXAMPLE ( changed to nworders.example ) cataloged successfully
jsh Z2018 ~ -->GET-LIST EXAMPLE.LIST
2 Records selected
>NWORDERS.EXAMPLE
2 Records selected
{
"records":[
{
"orderid": "10301",
"customerid": "WANDK",
"employeeid": "8",
"orderdate": "09-09-1996",
"items":[
{
"productid": "40",
"unitprice": "14.70",
"quantity": "10"
},
{
"productid": "56",
"unitprice": "30.40",
"quantity": "20"
}
]
},
{
"orderid": "10258",
"customerid": "ERNSH",
"employeeid": "1",
"orderdate": "07-17-1996",
"items": [
{
"productid": "2",
"unitprice": "15.20",
"quantity": "50"
},
{
"productid":"5",
"unitprice":"17.00",
"quantity":"65"
},
{
"productid":"32",
"unitprice":"25.60",
"quantity":"6"
}
]
}
]
}
jsh Z2018 ~ -->
Create your own classes and convert output to JSON.
jDO enhances your ability to hire developers that don’t necessarily need to learn PICK BASIC to be successful and productive. Instead of spending time teaching people procedural code, let them work as they normally would in an Object-Oriented mindset and start delivering new innovations.
Enhanced Security
Unlike other database encryption solutions for MultiValue, ours just works!
jBASE encryption brings 256 AES encryption to all jBASE file types and indexes without changing your application. Benefit from the latest encryption algorithms for:
- Strong encryption using AES-256 symmetric cipher • Latest OpenSSL library provides cryptographic functions
- File encryption is stored in encrypted container requiring a separate key for access
- Simple yet powerful, supports modern encryption algorithms, meets modern ata security requirements, easy to configure and manage, fast
- Best of all, our encryption is safe and easy to implement.
Dynamic Files
Imagine your PICK system continually adjusting the size and structure of its data on its own? Welcome to Dynamic Files, a free feature that you can toggle on or off in jBASE 5.7. Underneath the hood, jBASE manages all the hash algorithms and disk allocation. But to the user, this means there is no more file resizing (as your data grows), and no more slowdowns if your file structure outgrows your file plan. In fact, Dynamic Files often run 3x faster that regular files and file sizes can grow up to 64TB on select 64-bit operating systems.
It’s easy to convert your existing files to Dynamic Files. Once converted, the maintenance on your data files should be significantly less. Also, there is no change necessary to your business logic to use this enhancement.
Docker Containers
Similar to the server virtualization revolution (led by juggernauts like VMware), containers are transforming software development. Containers automate the deployment of code by packaging everything up — the app, the operating system and all its dependencies — so your application runs quickly and reliably from one computing environment to another. Container technology uses only one instance of an operating system so images are small and portable.
Click here to watch a 60 second tutorial on running jBASE in a Docker Container.