03.03.2019, 18:15
Quote:
So you think repeatedly modifying code until it fixes all bugs and corner-cases is better than just using existing code that works?
|
Quote:
That’s not a good solution. If you have to have additional code before calling a function to ensure that the function works correctly, the function is no longer self-contained. This is called a “leaky abstraction”, and is where your code is directly tied to the internals of a function. If you call the function five times, you have to ensure all the other code is right five times. If there’s a bug you have to fix it five times, and hope you didn’t forget a sixth.
|
For example:
Код:
stock TimestampToDateForPlayer(playerid, Timestamp, &year, &month, &day, &hour, &minute, &second) { return TimestampToDate(Timestamp + tOffset[playerid][0]*3600 + tOffset[playerid][1]*60 + tOffset[playerid][2], year, month, day, hour, minute, second, 0); }
Additionally, this has nothing to do with leaky abstraction, it's simply making use of a personalizable function.
Furthermore, you'd need this in combination with the Chrono Plugin too.
Quote:
What’s that got to do with the video? Just because you’ve never hit the bugs that are provably there doesn’t mean they don’t exist and won’t be hit by other people.
|
If not, I do not see a reason why calling this function bugged.
Quote:
All plugins are required to release their source. They are no more a black-box than includes, and faster. You might not like plugins, and that’s up to you, but don’t inflict your ignorance on others but preventing them being suggested better code.
|
Actually, I do not even see the point of a discussion here. If I haven't had issues over half a decade with the function, I'm right to say the function works well for most requirements and most likely it fulfills Longover's requirements too. If not, he can use the plugin. It has nothing to do with ignorance, it's a simple suggestion based on my opinion and my experiences.