![]() I am eternally grateful to all the people who wrote on Stack Overflow and various forums, but i cannot make peace with the obvious fact that as soon as you get interested in how something works under the hood, there is no one around. The last time i felt this hopeless and angry at myself and Stack Overflow was a year ago when i researched for two days on how exactly iOS native scroll implemented gravity under the hood. ![]() Yes i am aware that sometimes it is necessary to play dirty like that, but come on, if you are willing to write a 1000 character answer, why not use the same amount of time to find a better way of doing it? After a unserialize, you have your Object. While we do manually transform data received from the client via form submit or API, we do it for validation and verification purposes, on the other hand unserializing data received from the DB is usually performed by the ORM itself, behind closed curtains.įor example, a bunch of people were willing to create a stdClass out of the JSON, and then serialize this stdClass into plain text while performing a brute-force regex replacement of Class name. Transform everything on input and output only, and always work with valid state objects, never with anonymous arrays. While no project is the same, most of them did solve this in a similar manner - and suddenly it made perfect sense: I decided i am not smart enough to solve this mess i made on my own, which got me to thinking about how this is handled on some large-scale projects i have worked on. 4 Services, 1 Provider, 1 transformer and 2 endpoints… Let the games begin.Ī hour into it, i realized that i have 4 transformers, which are used basically all over the place, and that most of my code is not the logic behind caching anymore, but a series of silly transformations, and guesses whether something is an object or an array, or in some instances a stdClass. The project was OO based, with an MVC model similar to an extremely simplified Symfony structure. ![]() The system was really simple as you might guess, but since calls to servers are expensive in the case of Instagram API, i created a basic local cache. ![]() I was working on a cute little project which uses the public guest Instagram API to showcase all posts from the client’s page. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |