You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can tell, MadelineProto's source code was inspired by Java development experience. Hence its excessive complexity, its convoluted nature, and its plethora of anti-patterns like class serialization, the use of reflection alongside class attributes, async/await, and the implementation of built-in language functions through third-party libraries like cryptography (sick).
Furthermore, it attempts to use multitasking through hacks like amphp instead of the built-in parallel, despite PHP itself being a single-tasking runtime.
All this leads to unreadable code, a nightmare for debugging asynchronous events, and an overload of functions that are 99% unnecessary.
What I propose:
Separate out the "server side" and make it standalone, which would be responsible for connecting to Telegram and listen on a Unix socket through which "clients" communicate. Something similar has already been implemented, but with an attempt to cram everything into a single library.
Remove class serialization entirely, as storing their states is essentially pointless.
Use JSON everywhere to store structures.
Add a global configuration file to store basic settings like logging or database connections. I can't imagine a situation where account 11111 needs to store data in MySQL, while account 22222 needs to be stored in Redis. And all on the same machine.
Add a simpler and clearer EventHandler concept that would define events via a public function onXXXXX(): onUserOnline, onChatMessage, etc., instead of the confusing and very implicit function definitions as is currently done.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
As far as I can tell, MadelineProto's source code was inspired by Java development experience. Hence its excessive complexity, its convoluted nature, and its plethora of anti-patterns like class serialization, the use of reflection alongside class attributes, async/await, and the implementation of built-in language functions through third-party libraries like cryptography (sick).
Furthermore, it attempts to use multitasking through hacks like amphp instead of the built-in parallel, despite PHP itself being a single-tasking runtime.
All this leads to unreadable code, a nightmare for debugging asynchronous events, and an overload of functions that are 99% unnecessary.
What I propose:
Separate out the "server side" and make it standalone, which would be responsible for connecting to Telegram and listen on a Unix socket through which "clients" communicate. Something similar has already been implemented, but with an attempt to cram everything into a single library.
Remove class serialization entirely, as storing their states is essentially pointless.
Use JSON everywhere to store structures.
Add a global configuration file to store basic settings like logging or database connections. I can't imagine a situation where account 11111 needs to store data in MySQL, while account 22222 needs to be stored in Redis. And all on the same machine.
Add a simpler and clearer EventHandler concept that would define events via a public function onXXXXX(): onUserOnline, onChatMessage, etc., instead of the confusing and very implicit function definitions as is currently done.
Beta Was this translation helpful? Give feedback.
All reactions