View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007609 | Scribus | Internal | public | 2008-11-13 12:46 | 2024-12-27 22:44 |
Reporter | dclemente | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.5svn | ||||
Fixed in Version | 1.7.0.svn | ||||
Summary | 0007609: In code: Replace constant numerical values with helpful named constants | ||||
Description | See for instance annot.cpp: case 0: item->annotation().setActionType(0); break; case 1: item->annotation().setActionType(1); switch (ScrEdited) { case 0: item->annotation().setAction(EditJava->text()); break; case 1: item->annotation().setD_act(EditJava->text()); break; case 2: ...... This is a mess, because you don't know what the values 0, 1, 2, ... represent. Neither the meaning of 1 in setActionType(1) nor all the „case“. This makes developing und understanding the code hard, specially for new programmers. It's better to use named constants like: AppMode.modeDrawRegularPolygon. Some of them are defined in scribusstructs.h, others somewhere also. Some are defined in an enum (good), but they are however accessed via a number (bad). This breaks the code if someone adds a new value in the middle of the enum, because numbers will change. To do: change all numerical constants into named constants (stored in enum) | ||||
Tags | No tags attached. | ||||
Patch | |||||
child of | 0002382 | acknowledged | Metabug: Code quality, structure, readability |
|
Quick access to see this: https://github.com/scribusproject/scribus/blob/master/scribus/ui/annot.cpp |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-11-13 12:46 | dclemente | New Issue | |
2015-06-20 13:23 | Kunda | Note Added: 0035464 | |
2015-06-29 04:12 | Kunda | Relationship added | child of 0002382 |
2024-12-26 16:48 | cbradney | Status | new => resolved |
2024-12-26 16:48 | cbradney | Resolution | open => fixed |
2024-12-26 16:48 | cbradney | Fixed in Version | => 1.7.0.svn |
2024-12-27 22:44 | cbradney | Status | resolved => closed |