Warning, /graphics/kst-plot/devel-docs/deprecated/whatiswrongwithkst2dplot.txt is written in an unsupported language. File is not indexed.
0001
0002 Kst2DPlot is a monstrosity. Here's why:
0003
0004 1) No single person understands it. Some people understand some of it. No-one
0005 understands all of it. it is quite possible that there are some parts of it
0006 that no-one understands.
0007
0008 2) It's HUGE. The header file alone is 630 lines. The source file is over ten
0009 times that.
0010
0011 3) It has all kinds of functions that are unclear or have side effects.
0012 Example:
0013 setBorders(xleft_bdr_px, xright_bdr_px, ytop_bdr_px, ybot_bdr_px,
0014 tpx, tpy, p, offsetX, offsetY, xtick_len_px, ytick_len_px);
0015 Can you guess what that does? It actually -gets- some values, for instance.
0016
0017 4) Can you guess what any of the variables in (3) mean/are?
0018
0019 5) It's C masquerading as C++. It's a whole bunch of function calls that call
0020 eachother in seemingly unconnected ways. Change one, you break something
0021 elsewhere.
0022
0023 6) Too many ways to do things, or too many things that look the same but aren't:
0024 void setCursorPos(QWidget *view);
0025 void unsetCursorPos(QWidget *view);
0026 void drawCursorPos(QWidget *view);
0027 void drawCursorPos(QPainter& p);
0028 void updateMousePos(const QPoint& pos);
0029
0030 7) Too many different internal states that get flipped back and forth
0031 externally. Display and state need to be separated. Caches should not be
0032 an internal part of the object, they should be abstract.
0033
0034 8) It doesn't come close to following our coding conventions.
0035
0036 9) Shortforms abound:
0037 setXTransformedExp, etcetera
0038
0039 10) Lack of verbosity:
0040 bool suppressRight() const;
0041 void setSuppressTop(bool yes);
0042
0043 11) Implementations in the header file. Makes it hard to fix things properly:
0044 int xMinorTicks() const { return _xMinorTicks - 1; }
0045 int yMinorTicks() const { return _yMinorTicks - 1; }
0046 bool xMinorTicksAuto() const { return _reqXMinorTicks < 0; }
0047 bool yMinorTicksAuto() const { return _reqYMinorTicks < 0; }
0048
0049 12) Passing return values by reference parameters! Evil!
0050
0051 13) Public methods that should be private
0052
0053 14) Way too many things in one class - there's no reason for it to do time
0054 conversions inside, for instance
0055
0056 15) Public member variables!!
0057
0058 16) Pointless virtuals
0059
0060 17) Count them: 107 member variables.
0061
0062 18) No design documentation
0063
0064 19) Inefficiencies all over
0065
0066 20) Algorithms are undocumented and unclear at best, mostly voodoo
0067
0068 21) Too many options are causing way too many branches and nested branches.
0069 This makes testing particularly difficult.
0070
0071 22) float<->int conversions are not well defined, happen far too often
0072
0073 23) C-style casts all over
0074
0075 24) Magic numbers like 1.666666.
0076
0077 25) Dumping grounds are just not cool
0078
0079