Developing and debugging server code in project applications has become easier than ever in 4D v18 R4. Without further ado, let’s take a look at how to do it.
Before going any further, we’re aware that there are many different client/server development scenarios, that’s why we’re preparing an upcoming blog post to show you ways to manage project application development within a team. In the meantime, let’s see how to develop, fine-tune, and debug server code.
This new behavior is very useful when developing stored procedures and methods executed on servers (e.g., web server methods and triggers, or commands returning specific results).
Reminder about general Client/Server behavior
You’ve certainly noticed that you can’t modify code or forms on the client side when developing project applications in client/server mode. The reason is because when connecting to the server, the client downloads a single .4DZ file containing all of the project files (i.e., a snapshot of the server code at the time of the connection).
Since .4DZ file is compressed, it provides many advantages: transferring it from 4D Server to 4D Remote is more efficient (using less bandwidth) and code integrity is preserved (no desynchronization between method calls and new method parameters, for example).
As a result, project files can’t be modified on the client side.
A NEW way to develop and debug server code
To save time and avoid having to restart your server application after each code modification (in standalone mode), we provide you the ability to refine and debug your server-side code.
From now on, when you connect a 4D Remote that is located on the same computer as the 4D Server, the remote 4D is able to modify the project files (code, forms, resources, etc.).
How does it work?
When a 4D Developer client connects to a 4D Server on the same computer, the .4DZ file is not transferred from the server to the client. The 4D Remote manages the project files (methods, forms, resources, etc.) as if it were a 4D single-user client. The project files are shared by 4D Server and 4D Remote.
This way, you can modify your code and test it on the fly.
If you want the server to reload the modified files, just switch from the development environment to application mode, move the 4D Server to the foreground or select the “File / Save all” menu item in the 4D Remote (or use the new RELOAD PROJECT command).
Remember that running a method on the client-side automatically performs a “Save all” action, and as a result it reloads the modified files on the server-side.
If you have any questions about this feature, feel free to join the discussion on the 4D Forum.