Friday, January 22, 2021

Are you REALLY editing what you think?

Developers should be aware, that sometimes they think they're editing a particular code, but it's in fact some other code. It may be the same file in a different project, or the same file but in a backup folder, or really the same file but wrong section of the code, or recently copied class to be modified as a different class, but you accidently started rewriting the original class,  or something else like so.

But even if you truly edit the correct piece of code, you're not out of the woods yet, because you may test your changes on a different one. For example, you're editing a local script, but running it on a server and wondering why your changes aren't there.

And there's also caching and compilation. PHP has opcache, which may keep the old code for minutes or hours. Also various frameworks cache precompiled code for better performance and after any change you need to wait for the cache to update, or update it manually.

If the code doesn't change after first few tries, make sure you're REALLY editing what you think. Because you can lose a lot of time because of such a silly reason. I didn't make up any of those scenarios, all of that happened to me. The only commiseration is I gained quite a lot of experience, as described before, to quickly realize the situation.

Thursday, January 14, 2021

QStore

I'm really fine how DataStores (DS) work on the server, but on the client... not so much. Probably because there are much more DS on frontend, as I considered every endpoint as a separate DS.

I decided to look at DS as a SOAP web service, that has functions. An adaptor between an API as a whole, and the module or even the app.

I needed to deal with failed calls (like temporary absence of mobile data), so it required some sort of queue (more like a stack).

There are also cached data, both temporarily and persistently, like preloaded pages or module definitions, user sessions or component data.