▲ | 3eb7988a1663 4 days ago | |
Do you mean like is the User object is a well formed User, or did someone actually give you an int? As to the first problem, I recommend the Parse don't validate post[0]. The essential idea is stop using god objects that do it all, but use specific types to make contracts on what is known. Separate out concerns so there is an UnvalidatedUser (not serialized and lacking a primary key) and a ValidatedUser (committed to the database, has unique username, etc). Basic type hinting should get you the rest of the way to cleaning up code paths where you get some type certainty. [0] https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va... |