论坛首页 Java企业应用论坛

看到这么雷人的代码,真是悲催

浏览 124061 次
该帖已经被评为精华帖
作者 正文
   发表时间:2011-11-17  
还以为是我同事发的
0 请登录后投票
   发表时间:2011-11-19  
都发表意见了,看热闹的,贬低的,那么就请大牛们重构一下吧.
0 请登录后投票
   发表时间:2011-11-21  
nianien 写道
	public CktsQfxxHsh(String hjBh, String fqfZt, String jsfZt, String qcrDm,
			String qcrXm, String fhrDm, String fhrXm, String qfrDm,
			String qfrXm, String nsrsbhGf, String nsrxmGf, String nsrsbhXf,
			String nsrxmXf, String swjgDmJsf, String swjgDmFqf,
			String swjgJcFqf, String swjgJcJsf, String bfpryDm, String bspryMc,
			String lxrXm, String lxrDh, String lxrDz, String lxrYb, Date sjSc,
			Date sjFs, Date sjTjfh, Date sjTjqf, String hjLx, BigDecimal fpfs,
			BigDecimal jeHj, BigDecimal seHj, BigDecimal jshjHj, String qtqk,
			BigDecimal tseY, BigDecimal tseZbbl, String fhsm, Date fuhjzrq,
			Date rqTk, Date sjFuhfs, String dyfhBh, String yqfhBz, String fhBz,
			String cbBz, Date sjCbhfs) {
		this.hjBh = hjBh;
		this.fqfZt = fqfZt;
		this.jsfZt = jsfZt;
		this.qcrDm = qcrDm;
		this.qcrXm = qcrXm;
		this.fhrDm = fhrDm;
		this.fhrXm = fhrXm;
		this.qfrDm = qfrDm;
		this.qfrXm = qfrXm;
		this.nsrsbhGf = nsrsbhGf;
		this.nsrxmGf = nsrxmGf;
		this.nsrsbhXf = nsrsbhXf;
		this.nsrxmXf = nsrxmXf;
		this.swjgDmJsf = swjgDmJsf;
		this.swjgDmFqf = swjgDmFqf;
		this.swjgJcFqf = swjgJcFqf;
		this.swjgJcJsf = swjgJcJsf;
		this.bfpryDm = bfpryDm;
		this.bspryMc = bspryMc;
		this.lxrXm = lxrXm;
		this.lxrDh = lxrDh;
		this.lxrDz = lxrDz;
		this.lxrYb = lxrYb;
		this.sjSc = sjSc;
		this.sjFs = sjFs;
		this.sjTjfh = sjTjfh;
		this.sjTjqf = sjTjqf;
		this.hjLx = hjLx;
		this.fpfs = fpfs;
		this.jeHj = jeHj;
		this.seHj = seHj;
		this.jshjHj = jshjHj;
		this.qtqk = qtqk;
		this.tseY = tseY;
		this.tseZbbl = tseZbbl;
		this.fhsm = fhsm;
		this.fuhjzrq = fuhjzrq;
		this.sjFuhfs = sjFuhfs;
		this.dyfhBh = dyfhBh;
		this.yqfhBz = yqfhBz;
		this.fhBz = fhBz;
		this.cbBz = cbBz;
		this.sjCbhfs = sjCbhfs;
	}


楼主做税务的吧。。。
类名能拼出:出口退税
字段拼出:纳税人,税务机关。。。。。
应该是哪大连龙图有关。。。。
0 请登录后投票
   发表时间:2011-11-21  
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah)
{
this.version = "020320 [Menu; mm_menu.js]";
this.type = "Menu";
this.menuWidth = mw;
this.menuItemHeight = mh;
this.fontSize = fs;
this.fontWeight = "plain";
this.fontFamily = fnt;
this.fontColor = fclr;
this.fontColorHilite = fhclr;
this.bgColor = "#555555";
this.menuBorder = 1;
this.menuBgOpaque=opq;
this.menuItemBorder = 1;
this.menuItemIndent = idt;
this.menuItemBgColor = bg;
this.menuItemVAlign = valgn;
this.menuItemHAlign = halgn;
this.menuItemPadding = pad;
this.menuItemSpacing = space;
this.menuLiteBgColor = "#ffffff";
this.menuBorderBgColor = "#777777";
this.menuHiliteBgColor = bgh;
this.menuContainerBgColor = "#cccccc";
this.childMenuIcon = "arrows.gif";
this.submenuXOffset = sx;
this.submenuYOffset = sy;
this.submenuRelativeToItem = srel;
this.vertical = vert;
this.items = new Array();
this.actions = new Array();
this.childMenus = new Array();
this.hideOnMouseOut = true;
this.hideTimeout = to;
this.addMenuItem = addMenuItem;
this.writeMenus = writeMenus;
this.MM_showMenu = MM_showMenu;
this.onMenuItemOver = onMenuItemOver;
this.onMenuItemAction = onMenuItemAction;
this.hideMenu = hideMenu;
this.hideChildMenu = hideChildMenu;
if (!window.menus) window.menus = new Array();
this.label = " " + label;
window.menus[this.label] = this;
window.menus[window.menus.length] = this;
if (!window.activeMenus) window.activeMenus = new Array();
}

看来这种代码还很多人用呢
0 请登录后投票
   发表时间:2011-11-22  
如果是已经写好的代码,不能更改,就自己找到方法把他屏蔽掉,例如工厂方法,外观模式,重构等手段。如果一个业务真的有这么多字段,也没有好的方法。即使使用对象封装,也要写这样的代码对应上!所以,只能在如何更清晰的处理问题上着手了!

向动态语言使用的   new Clazz(fieldA:value1,field2:value2)
1) 类似可以采用Map封转,后端解析
2) 前者有人说过的“field1:value1,field2:value2”,后台函数解析!
还有很多方法,只是屏蔽掉调用者的困惑即可,后端复杂,什么傻瓜代码也无所谓,都是可以后期改进的!
0 请登录后投票
   发表时间:2011-11-22  
我曾经改过类似的东西,六种状态,每个状态下面页面的字段赋值都不全部一样,页面字段有25-30个,业务比较复杂,改了半个月,都不想活了
0 请登录后投票
   发表时间:2011-11-24  
这种重复性的,不复杂的代码,通常采用 反射 来处理,能够简单些!
0 请登录后投票
   发表时间:2011-11-25  
这真的没什么, 一看就是金融业的bean,  一个构造么, 放在那里爱用不用很正常么, 并且命名在这个项目的人员更具这个类了解这些字段肯定是一目了然,有什么好拿出来的,
我就想不通,就想当于set赋值,还什么模式都出来了, 真的想笑,

标题还来个《看到这么雷人的代码,真是悲催》  楼主无聊

勿喷
0 请登录后投票
   发表时间:2011-11-25  
呵呵,看下,不发表意见
0 请登录后投票
   发表时间:2011-11-26  
nianien 写道
	public CktsQfxxHsh(String hjBh, String fqfZt, String jsfZt, String qcrDm,
			String qcrXm, String fhrDm, String fhrXm, String qfrDm,
			String qfrXm, String nsrsbhGf, String nsrxmGf, String nsrsbhXf,
			String nsrxmXf, String swjgDmJsf, String swjgDmFqf,
			String swjgJcFqf, String swjgJcJsf, String bfpryDm, String bspryMc,
			String lxrXm, String lxrDh, String lxrDz, String lxrYb, Date sjSc,
			Date sjFs, Date sjTjfh, Date sjTjqf, String hjLx, BigDecimal fpfs,
			BigDecimal jeHj, BigDecimal seHj, BigDecimal jshjHj, String qtqk,
			BigDecimal tseY, BigDecimal tseZbbl, String fhsm, Date fuhjzrq,
			Date rqTk, Date sjFuhfs, String dyfhBh, String yqfhBz, String fhBz,
			String cbBz, Date sjCbhfs) {
		this.hjBh = hjBh;
		this.fqfZt = fqfZt;
		this.jsfZt = jsfZt;
		this.qcrDm = qcrDm;
		this.qcrXm = qcrXm;
		this.fhrDm = fhrDm;
		this.fhrXm = fhrXm;
		this.qfrDm = qfrDm;
		this.qfrXm = qfrXm;
		this.nsrsbhGf = nsrsbhGf;
		this.nsrxmGf = nsrxmGf;
		this.nsrsbhXf = nsrsbhXf;
		this.nsrxmXf = nsrxmXf;
		this.swjgDmJsf = swjgDmJsf;
		this.swjgDmFqf = swjgDmFqf;
		this.swjgJcFqf = swjgJcFqf;
		this.swjgJcJsf = swjgJcJsf;
		this.bfpryDm = bfpryDm;
		this.bspryMc = bspryMc;
		this.lxrXm = lxrXm;
		this.lxrDh = lxrDh;
		this.lxrDz = lxrDz;
		this.lxrYb = lxrYb;
		this.sjSc = sjSc;
		this.sjFs = sjFs;
		this.sjTjfh = sjTjfh;
		this.sjTjqf = sjTjqf;
		this.hjLx = hjLx;
		this.fpfs = fpfs;
		this.jeHj = jeHj;
		this.seHj = seHj;
		this.jshjHj = jshjHj;
		this.qtqk = qtqk;
		this.tseY = tseY;
		this.tseZbbl = tseZbbl;
		this.fhsm = fhsm;
		this.fuhjzrq = fuhjzrq;
		this.sjFuhfs = sjFuhfs;
		this.dyfhBh = dyfhBh;
		this.yqfhBz = yqfhBz;
		this.fhBz = fhBz;
		this.cbBz = cbBz;
		this.sjCbhfs = sjCbhfs;
	}


汗颜,这人是不是疯了
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics