What are the best practices for developing consistent libraries?

I am working on developing a pair of libraries for working with the REST API. Since I need to be able to use the API in a variety of settings, I am currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications and lengthy processes). Are there any better methods to consider when designing libraries to help maintain my own sanity?

+3
source share
6 answers

Thus, the problem with the development of parallel libraries in different languages ​​is that often different languages ​​have different idioms for the same task. I know this from personal experience by placing a library from Python to PHP. Idioms are not just naming: for example, Python has a lot of magic that you can use with getters and setters to make object properties magical; Python has monkeypatching; Python named parameters.

With the port, you want to select the "base" language, and then try to imitate all the idioms in another language (not easy to do); for parallel development, do nothing too complicated and maintain the least common denominator. Then fix syntactic sugar.

+6
source

" ": , - , API . , "" API, .

+2

unit test . , . , , .

+2

, . ( ) . , API . , ( , ) , . , , API REST , : Ruby Scala. Ruby MyCompany::Foo, bar_baz(). , Scala API com.mycompany.rest.Foo barBaz(). , , , API "" , .

, : , , . API .

0

AFAIKT . , , Jruby, Ruby + Java, Ruby Python ( ). , Etoile, Objective-C, Python Smalltalk, : C, libxml2, libcurl .. , . , Python, PHP. , parrallel.

Or maybe it’s not the worst idea to base this material on .NET, then you will suddenly have a whole bunch of languages ​​that, in principle, should be used from any other language on the .NET platform.

0
source

Why not use python for web applications? there are several possibilities: django, web2py - similar to django, but many say it is easier to use, there are also TurboGears, web.py, Pylons

along the bridge lines - you can use interprocess communication so that PHP and the python application (in daemon mode) talk to each other.

0
source

Source: https://habr.com/ru/post/1698164/


All Articles