Article 5J0D5 CodeSOD: Meaningful Article Title

CodeSOD: Meaningful Article Title

by
Remy Porter
from The Daily WTF on (#5J0D5)

There was an era where UI designer tools output programmatic code representing that UI. So, say, if you were dragging and dropping objects in the Windows Forms designer in Visual Studio, the output would be C# code. Now, the designer would have some defaults. When you added a new button, it might identify it as button15. Of course, you wouldn't leave that name as it was, and you'd give it a meaningful name. That name would then become the property name of that field in the class generated by the designer.

Well, you might give it a meaningful name. Gormo inherited some Windows Forms code, which challenges the meaning of "meaningful names".

 private System.Windows.Forms.ComboBox _cb_PG_PG_K; private System.Windows.Forms.ComboBox _cb_LPVB_V_K; private System.Windows.Forms.ComboBox _cb_LPVB_W; private System.Windows.Forms.ComboBox _cb_LPVB_K; private System.Windows.Forms.ComboBox _cb_LPVB_TRO; private System.Windows.Forms.ComboBox _cb_LPVB_Z; private System.Windows.Forms.ComboBox _cb_LP_MV; private System.Windows.Forms.ComboBox _cb_LP_AG; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.ComboBox _cb_LP_HB; private System.Windows.Forms.ComboBox _cb_LP_GSGS; private System.Windows.Forms.ComboBox _cb_LP_GSGN; private System.Windows.Forms.ComboBox _cb_LP_SF; private System.Windows.Forms.ComboBox _cb_LP_CBI; private System.Windows.Forms.ComboBox _cb_LP_E; private System.Windows.Forms.ComboBox _cb_LP_CAS; private System.Windows.Forms.Button _btnQ_LP_MV; private System.Windows.Forms.Button _btnQ_LP_AG; private System.Windows.Forms.Button _btnQ_LP_HB; private System.Windows.Forms.Button _btnQ_LP_GSGS; private System.Windows.Forms.Button _btnQ_LP_GSGN; private System.Windows.Forms.Button _btnQ_LP_SF; private System.Windows.Forms.Button _btnQ_LP_CBI; private System.Windows.Forms.Button _btnQ_LP_E; private System.Windows.Forms.Button _btnQ_LP_CAS; private System.Windows.Forms.Button _btnQ_LP_PK; private System.Windows.Forms.Button _btnQ_LP_PG_K; private System.Windows.Forms.Button _btnQ_LP_P; private System.Windows.Forms.Button _btnQ_LP_P_K; private System.Windows.Forms.Button _btnQ_LPB_PB_K; private System.Windows.Forms.Button _btnQ_LBSV_BSV_K; private System.Windows.Forms.Button _btnQ_cb_LV_V_K; private System.Windows.Forms.Button _btnQ_cbLM_M_ID; private System.Windows.Forms.Button _btnQ_LE_E; private System.Windows.Forms.Button _btnQ_BHVS_BV; private System.Windows.Forms.Button _btnQ_BHVS_BV_K; private System.Windows.Forms.Button _btnQ_BSTVS_BST_K; private System.Windows.Forms.Button _btnQ_PVB_W; private System.Windows.Forms.Button _btnQ_PVB_K; private System.Windows.Forms.Button _btnQ_PVB_TRE; private System.Windows.Forms.Button _btnQ_PVB_TRO; private System.Windows.Forms.Button _btnQ_PVB_Z; private System.Windows.Forms.Button _btnQ_PVB; private System.Windows.Forms.Button _btnQ_PVB_PVB_K; private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label13; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.CheckBox _chkb_Filtern; private System.Windows.Forms.ComboBox _cbLM_M_ID; private System.Windows.Forms.ComboBox _cb_LP_PK; private System.Windows.Forms.ComboBox _cbLM_N; private System.Windows.Forms.ComboBox _cb_PG_PG; private System.Windows.Forms.ComboBox _cb_LPB_PB_K; private System.Windows.Forms.ComboBox _cb_LPB_PB; private System.Windows.Forms.ComboBox _cb_LV_V; private System.Windows.Forms.ComboBox _cb_LV_V_L; private System.Windows.Forms.ComboBox _cb_LBSV_BSV_K; private System.Windows.Forms.ComboBox _cb_LBSV_BSV; private System.Windows.Forms.ComboBox _cb_BSTVS_BST_K; private System.Windows.Forms.ComboBox _cb_LPVB_PVB; private System.Windows.Forms.ComboBox _cb_BSTVS_BST; private System.Windows.Forms.ComboBox _cb_LPVB_PVB_K; private System.Windows.Forms.ComboBox _cb_BHVS_BV_K; private System.Windows.Forms.ComboBox _cb_BHVS_BV; private System.Windows.Forms.Label _labelcb; private System.Windows.Forms.ComboBox _cb_M; private System.Windows.Forms.ComboBox _cb_LE_E; private System.Windows.Forms.Button _btn_Export; private System.Windows.Forms.CheckBox _chkb_M; private System.Windows.Forms.ComboBox _cb_LP_P; private System.Windows.Forms.ComboBox _cb_LP_P_K; private System.Windows.Forms.Button _btn_M; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.RadioButton _rb_123; private System.Windows.Forms.RadioButton _rb_ABC; private System.Windows.Forms.Button _btnQ_PMGR_PM_G; private System.Windows.Forms.Button _btnQ_PMGR_PM_G_K; private System.Windows.Forms.ComboBox _cb_LPMGR_PM_G; private System.Windows.Forms.ComboBox _cb_LPMGR_PM_G_K; private System.Windows.Forms.CheckBox _chkbLPMG; private System.Windows.Forms.CheckBox _chkb_A; private System.Windows.Forms.ListBox _lb_ERG; private System.Windows.Forms.CheckBox _chkb_LE; private System.Windows.Forms.CheckBox _chkb_BHVS; private System.Windows.Forms.CheckBox _chkb_BSTVS; private System.Windows.Forms.CheckBox _chkb_LP; private System.Windows.Forms.CheckBox _chkb_LPG; private System.Windows.Forms.CheckBox _chkb_LBSTV; private System.Windows.Forms.CheckBox _chkb_LPB; private System.Windows.Forms.CheckBox _chkb_LV; private System.Windows.Forms.CheckBox _chkb_LM; private System.Windows.Forms.CheckBox _chkb_LPVB; private System.Windows.Forms.RadioButton _rb_LM_Z; private System.Windows.Forms.RadioButton _rb_LM_E; private System.Windows.Forms.Panel _p_N; private System.Windows.Forms.CheckBox _chkb_ERG_S; private System.Windows.Forms.CheckBox _chkb_ERG_A; private System.Windows.Forms.CheckBox _chkb_dbS; private System.Windows.Forms.Button button1; private System.Windows.Forms.ComboBox _cb_LPVB_TRE; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button33; private System.Windows.Forms.Button button31; private System.Windows.Forms.Button button30; private System.Windows.Forms.Button button29; private System.Windows.Forms.Button button28; private System.Windows.Forms.Button button27; private System.Windows.Forms.Button button26; private System.Windows.Forms.Button button25; private System.Windows.Forms.Button button24; private System.Windows.Forms.Button button23; private System.Windows.Forms.Button button21; private System.Windows.Forms.Button button19; private System.Windows.Forms.Button button17; private System.Windows.Forms.Button button15; private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button3; private System.Windows.Forms.ComboBox _cb_BSTVS_V_K; private System.Windows.Forms.Button button11; private System.Windows.Forms.ComboBox _cb_BHVS_V_K; private System.Windows.Forms.Button button9; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btn_fieldNames;

So, what's worse than naming your combobox combobox1? Naming it _cb_PG_PG_K, which is exactly the sound I'd make if someone handed this code to me and told me I owned it now. I'm sure these names were all part of a coding scheme that was meaningful to the original developer, but they didn't write it down, so no one else knows what this genius scheme means, beyond the obvious Hungarian notation, like _cb (marking something as a combo box). What does BHVS_V_K mean beyond someone mashing random keys on the keyboard?

The real WTF, however, is clearly that this pile of fields on a form is a clear indicator that this is one of those kinds of UIs that fits the "your company's app" section of this classic comic.

proget-icon.png [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more. TheDailyWtf?d=yIl2AUoC8zAiCy2zUesLPA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments