1 Replies - 2163 Views - Last Post: 19 May 2016 - 11:27 AM Rate Topic: -----

#1 Alcep  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 09-March 16

Avoid blobs

Posted 10 March 2016 - 01:00 AM

I've worked on quite a few bad projects, I wish I had saved more examples to share. I guess I've just been lucky that way :D

This "senior" likes god objects. He seems to think it's a good idea to shove a bunch of data into objects with obscure, unintuitive property names. When approached about how this practice would spiral into an unmaintainable nightmare, he shrugged it off stating "Yea, nothing's perfect". At least make an effort man :(

The class itself is thousands of lines long. I created a deep JSONIFY to get a idea of what this object looked like. This isn't an actual representation of how large this object actually is. This is just one of at least 7 god objects in the project.

{
	"id": 1473,
	"firstname": "Jane",
	"lastname": "Doe",
	"spousename": "",
	"spouselastname": "",
	"address": "",
	"city": "",
	"state": "",
	"zip": null,
	"agentid": 66,
	"person": [{
		"persontypeid": 0,
		"dob": "1960-01-01",
		"retireage": 65,
		"retiremonth": 3,
		"genderid": 0,
		"payperyear": 12,
		"raises": 3,
		"raisecheckno": 7,
		"raisemethodid": 0,
		"raisestartdate": "2015-09-25",
		"spousedob": "1960-01-01",
		"ssage": 65,
		"pensionplanid": 212,
		"pensionplanstateid": 0,
		"pensioncustomdata": [],
		"doe": "1990-01-01",
		"paycheckvalue": 5000,
		"lifeexpectmethod": 0,
		"lifeexpectoffset": 10,
		"lifeexpectage": 95,
		"lifeexpectpercentile": 60,
		"ssstartmethod": 1,
		"ssvaluemethod": 0,
		"ssknownvalue": 0,
		"sssubjecttowep": true,
		"sswepyears": 30,
		"ssincomeyears": 35,
		"sspercentofcalcvalue": 100,
		"hasbreaksinservice": false,
		"dbaddyos": 0,
		"dbaddfunds": 0,
		"dbfasmethod": 0,
		"dbfasvalue": 0,
		"dcbalance": 0,
		"dcrate": 6,
		"dcerpercent": 0,
		"dcermatchpercent": 0,
		"dcerpercentmatchmax": 0,
		"dceecontribmethodid": 0,
		"dceeelectivepercent": 0,
		"dceeelectivedollar": 0,
		"dceecontribincmethodid": 0,
		"dceecontribincpercent": 0,
		"dceecontribincdollar": 0,
		"dceecontribincpercentage": 0,
		"dceecontribincterm": 0,
		"annualincome": 0,
		"dbactiveoptionid": 0,
		"dbdivorcereductionmethod": 0,
		"dbdivorcereductiondollar": 0,
		"dbdivorcereductionpercent": 0,
		"dbusecashbalanceasincome": false,
		"pensionpayoutmethodid": 2,
		"pensionpayoutrate": 4,
		"pensionpayoutpercent": 4,
		"pensionpayoutdollar": 0,
		"pensiondiststartmethodid": 0,
		"pensiondiststartdate": null,
		"pensiondiststartownersage": 40,
		"pensiondiststartyears": 0,
		"pensionannuityrate": 4,
		"rothbalance": 0,
		"rothpreretirerate": 0,
		"rothcontribmethodid": 0,
		"rothcontribpercent": 0,
		"rothcontribdollar": 0,
		"rothcontribincmethodid": 0,
		"rothcontribincpercent": 0,
		"rothcontribincdollar": 0,
		"rothcontribincpercentage": 0,
		"rothcontribincterm": 0,
		"rothdistribution": {
			"distmethodid": 0,
			"startmethodid": 0,
			"startdate": "2020-01-01",
			"startownersage": 40,
			"startyearsafterretire": 0,
			"payoutpercent": 0,
			"payoutdollar": 0,
			"rateofreturn": 0,
			"annuityrate": 0,
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/accountdistributionmodel"
		},
		"profitsharingclass": "",
		"ssmodelid": 0,
		"PayProjCOLA": 0,
		"PayProjAccumROR": 0,
		"PayProjPayoutROR": 0,
		"PayProjPlan2Balance": 0,
		"PayProjPlan2RothBalance": 0,
		"PayProjPlan1Balance": 0,
		"PayProjPlan1RothBalance": 0,
		"federalaccount": {
			"contribmethodid": 0,
			"userothact": true,
			"pretaxbalance": 0,
			"pretaxpercent": 0,
			"pretaxdollar": 0,
			"pretaxpreretireror": 0,
			"pretaxdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"rothbalance": 0,
			"rothpercent": 0,
			"rothdollar": 0,
			"rothpreretireror": 0,
			"rothdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"employeetypeid": 0,
			"retirementtypeid": 0,
			"transferedfromcsrs": false,
			"transferdate": "2000-01-01",
			"has40ssquarters": false,
			"cbpooptout": false,
			"diststartmethodid": 0,
			"diststartage": 62,
			"militaryyosunpurchased": 0,
			"militaryyospurchased": 0,
			"militarysvchasunpurchased": false,
			"ferssupphascola": false,
			"ferssuppage62value": 0,
			"ferssuppage62methodid": 0,
			"isvaorpostalworker": false,
			"fersvatitle38worker": false,
			"sickhoursperweek": 0,
			"sickaccumhours": 0,
			"csrsoffsetdate": "1990-01-01",
			"csrsoffset62ss": 2000,
			"csrsoffset62offsetss": 1800,
			"csrsoffsetcustomssinflation": true,
			"csrsoffsetssinflation": 2.5,
			"dirtyFlag": "Function - No return",
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/federalmodel"
		},
		"retireDateLimited": false,
		"breaksinservice": [],
		"dirtyFlag": "Function - No return",
		"getPromptValue": "Function - Params: 'name'",
		"setPromptValue": "Function - Params: 'name', value', update'",
		"calcRetireDate": "Function - Params: ''",
		"formatRetireDate": "Function - Params: ''",
		"assign": "Function - Params: 'data'",
		"__moduleId__": "model/personmodel"
	}, {
		"persontypeid": 1,
		"dob": "1960-01-01",
		"retireage": 65,
		"retiremonth": 6,
		"genderid": 0,
		"payperyear": 12,
		"raises": 3,
		"raisecheckno": 7,
		"raisemethodid": 0,
		"raisestartdate": "2015-09-25",
		"spousedob": "1960-01-01",
		"ssage": 65,
		"pensionplanid": 212,
		"pensionplanstateid": 0,
		"pensioncustomdata": [],
		"doe": "1990-01-01",
		"paycheckvalue": 5000,
		"lifeexpectmethod": 0,
		"lifeexpectoffset": 10,
		"lifeexpectage": 95,
		"lifeexpectpercentile": 60,
		"ssstartmethod": 1,
		"ssvaluemethod": 0,
		"ssknownvalue": 0,
		"sssubjecttowep": true,
		"sswepyears": 30,
		"ssincomeyears": 35,
		"sspercentofcalcvalue": 100,
		"hasbreaksinservice": false,
		"dbaddyos": 0,
		"dbaddfunds": 0,
		"dbfasmethod": 0,
		"dbfasvalue": 0,
		"dcbalance": 0,
		"dcrate": 6,
		"dcerpercent": 0,
		"dcermatchpercent": 0,
		"dcerpercentmatchmax": 0,
		"dceecontribmethodid": 0,
		"dceeelectivepercent": 0,
		"dceeelectivedollar": 0,
		"dceecontribincmethodid": 0,
		"dceecontribincpercent": 0,
		"dceecontribincdollar": 0,
		"dceecontribincpercentage": 0,
		"dceecontribincterm": 0,
		"annualincome": 0,
		"dbactiveoptionid": 0,
		"dbdivorcereductionmethod": 0,
		"dbdivorcereductiondollar": 0,
		"dbdivorcereductionpercent": 0,
		"dbusecashbalanceasincome": false,
		"pensionpayoutmethodid": 2,
		"pensionpayoutrate": 4,
		"pensionpayoutpercent": 4,
		"pensionpayoutdollar": 0,
		"pensiondiststartmethodid": 0,
		"pensiondiststartdate": null,
		"pensiondiststartownersage": 40,
		"pensiondiststartyears": 0,
		"pensionannuityrate": 4,
		"rothbalance": 0,
		"rothpreretirerate": 0,
		"rothcontribmethodid": 0,
		"rothcontribpercent": 0,
		"rothcontribdollar": 0,
		"rothcontribincmethodid": 0,
		"rothcontribincpercent": 0,
		"rothcontribincdollar": 0,
		"rothcontribincpercentage": 0,
		"rothcontribincterm": 0,
		"rothdistribution": {
			"distmethodid": 0,
			"startmethodid": 0,
			"startdate": "2020-01-01",
			"startownersage": 40,
			"startyearsafterretire": 0,
			"payoutpercent": 0,
			"payoutdollar": 0,
			"rateofreturn": 0,
			"annuityrate": 0,
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/accountdistributionmodel"
		},
		"profitsharingclass": "",
		"ssmodelid": 0,
		"PayProjCOLA": 0,
		"PayProjAccumROR": 0,
		"PayProjPayoutROR": 0,
		"PayProjPlan2Balance": 0,
		"PayProjPlan2RothBalance": 0,
		"PayProjPlan1Balance": 0,
		"PayProjPlan1RothBalance": 0,
		"federalaccount": {
			"contribmethodid": 0,
			"userothact": true,
			"pretaxbalance": 0,
			"pretaxpercent": 0,
			"pretaxdollar": 0,
			"pretaxpreretireror": 0,
			"pretaxdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"rothbalance": 0,
			"rothpercent": 0,
			"rothdollar": 0,
			"rothpreretireror": 0,
			"rothdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"employeetypeid": 0,
			"retirementtypeid": 0,
			"transferedfromcsrs": false,
			"transferdate": "2000-01-01",
			"has40ssquarters": false,
			"cbpooptout": false,
			"diststartmethodid": 0,
			"diststartage": 62,
			"militaryyosunpurchased": 0,
			"militaryyospurchased": 0,
			"militarysvchasunpurchased": false,
			"ferssupphascola": false,
			"ferssuppage62value": 0,
			"ferssuppage62methodid": 0,
			"isvaorpostalworker": false,
			"fersvatitle38worker": false,
			"sickhoursperweek": 0,
			"sickaccumhours": 0,
			"csrsoffsetdate": "1990-01-01",
			"csrsoffset62ss": 2000,
			"csrsoffset62offsetss": 1800,
			"csrsoffsetcustomssinflation": true,
			"csrsoffsetssinflation": 2.5,
			"dirtyFlag": "Function - No return",
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/federalmodel"
		},
		"retireDateLimited": false,
		"breaksinservice": [],
		"dirtyFlag": "Function - No return",
		"getPromptValue": "Function - Params: 'name'",
		"setPromptValue": "Function - Params: 'name', value', update'",
		"calcRetireDate": "Function - Params: ''",
		"formatRetireDate": "Function - Params: ''",
		"assign": "Function - Params: 'data'",
		"__moduleId__": "model/personmodel"
	}],
	"dirtyFlag": "Function - No return",
	"hasError": "Function - Params: ''",
	"name": "Function - Params: ''",
	"assign": "Function - Params: 'data'",
	"__moduleId__": "model/clientmodel",
	"person": {
		"persontypeid": 0,
		"dob": "1960-01-01",
		"retireage": 65,
		"retiremonth": 3,
		"genderid": 0,
		"payperyear": 12,
		"raises": 3,
		"raisecheckno": 7,
		"raisemethodid": 0,
		"raisestartdate": "2015-09-25",
		"spousedob": "1960-01-01",
		"ssage": 65,
		"pensionplanid": 212,
		"pensionplanstateid": 0,
		"pensioncustomdata": [],
		"doe": "1990-01-01",
		"paycheckvalue": 5000,
		"lifeexpectmethod": 0,
		"lifeexpectoffset": 10,
		"lifeexpectage": 95,
		"lifeexpectpercentile": 60,
		"ssstartmethod": 1,
		"ssvaluemethod": 0,
		"ssknownvalue": 0,
		"sssubjecttowep": true,
		"sswepyears": 30,
		"ssincomeyears": 35,
		"sspercentofcalcvalue": 100,
		"hasbreaksinservice": false,
		"dbaddyos": 0,
		"dbaddfunds": 0,
		"dbfasmethod": 0,
		"dbfasvalue": 0,
		"dcbalance": 0,
		"dcrate": 6,
		"dcerpercent": 0,
		"dcermatchpercent": 0,
		"dcerpercentmatchmax": 0,
		"dceecontribmethodid": 0,
		"dceeelectivepercent": 0,
		"dceeelectivedollar": 0,
		"dceecontribincmethodid": 0,
		"dceecontribincpercent": 0,
		"dceecontribincdollar": 0,
		"dceecontribincpercentage": 0,
		"dceecontribincterm": 0,
		"annualincome": 0,
		"dbactiveoptionid": 0,
		"dbdivorcereductionmethod": 0,
		"dbdivorcereductiondollar": 0,
		"dbdivorcereductionpercent": 0,
		"dbusecashbalanceasincome": false,
		"pensionpayoutmethodid": 2,
		"pensionpayoutrate": 4,
		"pensionpayoutpercent": 4,
		"pensionpayoutdollar": 0,
		"pensiondiststartmethodid": 0,
		"pensiondiststartdate": null,
		"pensiondiststartownersage": 40,
		"pensiondiststartyears": 0,
		"pensionannuityrate": 4,
		"rothbalance": 0,
		"rothpreretirerate": 0,
		"rothcontribmethodid": 0,
		"rothcontribpercent": 0,
		"rothcontribdollar": 0,
		"rothcontribincmethodid": 0,
		"rothcontribincpercent": 0,
		"rothcontribincdollar": 0,
		"rothcontribincpercentage": 0,
		"rothcontribincterm": 0,
		"rothdistribution": {
			"distmethodid": 0,
			"startmethodid": 0,
			"startdate": "2020-01-01",
			"startownersage": 40,
			"startyearsafterretire": 0,
			"payoutpercent": 0,
			"payoutdollar": 0,
			"rateofreturn": 0,
			"annuityrate": 0,
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/accountdistributionmodel"
		},
		"profitsharingclass": "",
		"ssmodelid": 0,
		"PayProjCOLA": 0,
		"PayProjAccumROR": 0,
		"PayProjPayoutROR": 0,
		"PayProjPlan2Balance": 0,
		"PayProjPlan2RothBalance": 0,
		"PayProjPlan1Balance": 0,
		"PayProjPlan1RothBalance": 0,
		"federalaccount": {
			"contribmethodid": 0,
			"userothact": true,
			"pretaxbalance": 0,
			"pretaxpercent": 0,
			"pretaxdollar": 0,
			"pretaxpreretireror": 0,
			"pretaxdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"rothbalance": 0,
			"rothpercent": 0,
			"rothdollar": 0,
			"rothpreretireror": 0,
			"rothdistribution": {
				"distmethodid": 0,
				"startmethodid": 0,
				"startdate": "2000-01-01",
				"startownersage": 40,
				"startyearsafterretire": 0,
				"payoutpercent": 0,
				"payoutdollar": 0,
				"rateofreturn": 0,
				"annuityrate": 0,
				"assign": "Function - Params: 'data'",
				"__moduleId__": "model/accountdistributionmodel"
			},
			"employeetypeid": 0,
			"retirementtypeid": 0,
			"transferedfromcsrs": false,
			"transferdate": "2000-01-01",
			"has40ssquarters": false,
			"cbpooptout": false,
			"diststartmethodid": 0,
			"diststartage": 62,
			"militaryyosunpurchased": 0,
			"militaryyospurchased": 0,
			"militarysvchasunpurchased": false,
			"ferssupphascola": false,
			"ferssuppage62value": 0,
			"ferssuppage62methodid": 0,
			"isvaorpostalworker": false,
			"fersvatitle38worker": false,
			"sickhoursperweek": 0,
			"sickaccumhours": 0,
			"csrsoffsetdate": "1990-01-01",
			"csrsoffset62ss": 2000,
			"csrsoffset62offsetss": 1800,
			"csrsoffsetcustomssinflation": true,
			"csrsoffsetssinflation": 2.5,
			"dirtyFlag": "Function - No return",
			"assign": "Function - Params: 'data'",
			"__moduleId__": "model/federalmodel"
		},
		"retireDateLimited": false,
		"breaksinservice": [],
		"dirtyFlag": "Function - No return",
		"getPromptValue": "Function - Params: 'name'",
		"setPromptValue": "Function - Params: 'name', value', update'",
		"calcRetireDate": "Function - Params: ''",
		"formatRetireDate": "Function - Params: ''",
		"assign": "Function - Params: 'data'",
		"__moduleId__": "model/personmodel"
	}



Is This A Good Question/Topic? 1
  • +

Replies To: Avoid blobs

#2 Jingle  Icon User is offline

  • D.I.C Regular

Reputation: 9
  • View blog
  • Posts: 323
  • Joined: 20-October 07

Re: Avoid blobs

Posted 19 May 2016 - 11:27 AM

I bet the program runs like lightning :wheelchair: with all the data stuck in giant objects getting thrown around. With my memory I can tell you that I would completely loose track of what anything on that means. Good luck working with that code!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1