Forum > Networking and Web Programming

Will FP be a good alternative to Go when writing microservices in backend?

(1/2) > >>

apterpont:
After reading this article/rant: https://www.reddit.com/r/programming/comments/uenpw2/lies_we_tell_ourselves_to_keep_using_golang/ I started looking for something that would treat JSON missing fields better by default.

How is FP in this regard? E.g. if some of the JSON field is missing will it be treated as 0 or null or something else?

Is FP a suitable alternative to Go for writing microservices for my web projects or I should stay with Go despite the problematic JSON treatment? Or try to use something completely different than FP or Go?

Have any of you done some microservices programming in FP? How it went? What pros and cons can you mention? What was good, and what was not so good?

Thank you in advance.

marcov:
FPC json classes currently don't work with automated marshalling.

I don't know GOlang that well, so I can't comment on the other.

PierceNg:
I've written a low-traffic microservice in Pascal using fcl-web and SQLite: It accepts HTTP POSTs, stores data in the SQLite database, and periodically processes said data. The service runs in a Docker container. No idea about auto-marshaling of JSON since the service doesn't face that. I use fptest for unit testing and fpmake for building both the service executable and the unit test driver program. Building headlessly using fpmake (or your own shell script) allows plugging into automated CI system.

For low volume microservices and monolithic web apps, available framework/libraries in Free Pascal work fine. This is not to say that Pascal is unsuitable for medium to high volume services, just that I have no experience using Pascal in these. But considering that people do run high-traffic sites/services implemented in Python and Ruby, probably Pascal won't do worse than those.

Main con in using Pascal is the comparatively much smaller ecosystem, so although Free Pascal comes mostly batteries included (here I mean also the stuff available on Github etc), your app code may have to deal with battery wiring and implement some batteries itself.

I've not written web stuff in Go, no comment.

SymbolicFrank:
There are many ways to write microservices. If you want something that translates code into JSON and URL's automatically (and vice versa), Free Pascal isn't going to do that.

On the other hand, Free Pascal is fully object-oriented, so if you want to be able to understand what happens and have more than just one or two microservices that only pass values to and from a database, it's far superior. It does have multiple JSON classes and there's even a few that treat JSON like a dataset.

Both allow you to run your code as a single executable that has the webserver build in, on multiple platforms.

PascalDragon:

--- Quote from: marcov on May 01, 2022, 02:02:08 pm ---FPC json classes currently don't work with automated marshalling.

--- End quote ---

Something like fpJSONRTTI doesn't factor into that answer?

Navigation

[0] Message Index

[#] Next page

Go to full version