![]() |
|
writing code that may still be in NBA18MT - Wersja do druku +- Autoxen Forum (http://forum.autoxen.pl) +-- Dział: Forum (/forumdisplay.php?fid=3) +--- Dział: Dystrybucja (/forumdisplay.php?fid=6) +--- Wątek: writing code that may still be in NBA18MT (/showthread.php?tid=1429) |
writing code that may still be in NBA18MT - rsgolecuicui - 15.02.2017 7:10 taking an introductory programming class might be scratching their head and thinking "aren't all programs supposed to be written like this?" The reality is that far more programs are Big Balls of Mud than not. Traditional imperative programming languages give you escape hatches, and they get used all the time. If you are just writing throwaway code, do whatever is most convenient, which often involves global state.If you are writing code that may still be in NBA 2K18 MT later, balance the convenience factor against the difficulties you will inevitably suffer later. Most developers are not very good at predicting the future time integrated suffering their changes will result in.Purity In PracticeNot everything can be pure; unless the program is only operating on its own source code, at some point you need to interact with the outside world. It can be fun in a puzzly sort of way to try to push purity to Cheap NBA 2K17 MT great lengths, but the pragmatic break acknowledges that side effects are necessary at some point, and manages them effectively.It doesn't even have to be all-or-nothing in a particular function. There is a continuum of value in how pure a function is, and the value step from almost-pure to pletely-pure is smaller than that from spaghetti-state to mostly-pure. Moving a function towards purity improves the code, even if it doesn't reach full purity. A function that bumps a global counter or checks a global debug is not pure, but if that is its only detraction, it is still going to reap most of the benefits.Avoiding the worst in a broader context is generally more important than achieving perfection in limited cases. If you consider the most toxic functions or systems you have had to NBA18MTdeal with, the ones that you know have to be handled with tongs and a face shield, it is an almost sure bet that they have a plex web of state and assumptions that their behavior relies on, and it isn't confined to their RE: writing code that may still be in NBA18MT - baron67x - 27.11.2017 22:28 ??co to jest RE: writing code that may still be in NBA18MT - dariousds34 - 13.01.2018 17:16 co to jestt? |