When you encounter an unsatisfactory view of working code, how likely is it to be reorganized? I know that the aesthetics of the code are mostly subjective, but I am very worried about the ugly code and it is difficult to resist the urge to clear it.
I do not like:
Heavy duty investment
AndFinally(AndThenDoThis(DoThis(strVar, 1, DoThat("February"))), FetchValue(0))
More brackets, commas and ampersands than necessary
CType(ctlGrid.DataSource, DataView).RowFilter = "HourlyRate > 100.00"
and consider adding a method (or extension method) to get
ctlGrid.DataView.RowFilter = "HourlyRate > 100.00"
alternately, I would change:
rows = tblEmp.Select("AnnualEarnings > " & dEarnings.ToString & " AND Position = '" & strPosition & "'")
:
rows = tblEmp.Select("AnnualEarnings > ? AND Position = ?", dEarnings, strPosition)
Now this is a bit extreme, but I'll even take a general idiom, for example, by finding the first element in an array and providing it with a method:
row = tblEmps.Select("Position = 'Manager'")(0)
becomes (and, I think, more readable):
row = tblEmps.Select("Position = 'Manager'").First
When I see it, it drives me crazy
frmMain.grdEmployees.colName.Bold = True
frmMain.grdEmployees.colName.Font = "Arial"
frmMain.grdEmployees.colName.BackColor = "lightyellow"
and regarding what is easier for me to read, I get:
With frmMain.grdEmployees.colName
.Bold = True
.Font = "Arial"
.BackColor = "lightyellow"
End With
. , - , .
, . Do not Make Me Think" . , ( -) , , , . , , , .
? "" ? ?