|
Where are the Goto statements in C++/C#??
Matt
(Find your own niche! This one's mine.)
|
|
|
|
|
Matt Sollars wrote: Where are the Goto statements in C++/C#??
Surely that is an oxymoron
You always pass failure on the way to success.
|
|
|
|
|
Matt
(Find your own niche! This one's mine.)
|
|
|
|
|
Yikes! Why not put entries = entries - 1 after Then
Also just have one if statement
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hmmm, that's pretty good compared to some of the code I've had to deal with
GuyThiebaut wrote: I found this piece of VeryBAd VBA code in an Excel spreadsheet I was amending today:
For counter = avgfirstrow To avglastrow cellvalue = Sheets(1).Cells(counter, 3).Value If cellvalue < 0 Then GoTo ignore If cellvalue > 99 Then GoTo ignore totalsum = totalsum + cellvalue GoTo nextoneignore: entries = entries - 1nextone:Next
I can assure you my left eyebrow is still twitching.
Gibber gibber....
My only guess is that Satan must have been whispering into my colleague's ear at the time.
|
|
|
|
|
I guess it makes sense, and works, in it's own eccentric manner.
You always pass failure on the way to success.
|
|
|
|
|
My company has a well organized naming rule.
It's a standard which has been developed for a few years.
Look:
Table names like: TB200010
View names like: VI600230
Procedure names like: USP980010_07R
Web services names like: WS210080.asmx
Web form page names like: UI400740.aspx
Reporting service page names like: RPT1731.aspx
There are thousands of objects like the aboves.
Here the example (real one):
// ????
public class UI200020
{
// ??? ??? ??
string TabPageUrl01 = ...;
string TabPageUrl02 = ...;
string TabPageUrl03 = ...;
string TabPageUrl04 = ...;
string TabPageUrl05 = ...;
// ??? ??
private WS980010.XD980010 xd980010UserInfo;
// ??? ????
WS200010 wsProxy = ...;
WS100010 wsProxy2 = ...;
// ? ???
protected System.Web.UI.WebControls.DataGrid dgListSub01;
protected System.Web.UI.WebControls.DataGrid dgListSub02;
protected System.Web.UI.WebControls.DataGrid dgListSub03;
protected System.Web.UI.WebControls.DataGrid dgListSub04;
protected System.Web.UI.WebControls.DataGrid dgListSub05;
protected System.Web.UI.WebControls.DataGrid dgListSub06;
protected System.Web.UI.WebControls.DataGrid dgListSub07;
protected System.Web.UI.WebControls.DataGrid dgListSub09;
protected System.Web.UI.WebControls.DataGrid dgListSub10;
protected System.Web.UI.WebControls.DataGrid dgListSub11;
protected System.Web.UI.WebControls.DataGrid dgListSub12;
// ???? ?? ?? ??
protected System.Web.UI.WebControls.ImageButton ibtnTabMore01;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore02;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore03;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore04;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore05;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore06;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore09;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore10;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore11;
protected System.Web.UI.WebControls.ImageButton ibtnTabMore12;
// ? ?? ??
protected System.Web.UI.WebControls.Label lblSUBTITLE01;
protected System.Web.UI.WebControls.Label lblSUBTITLE02;
protected System.Web.UI.WebControls.Label lblSUBTITLE03;
protected System.Web.UI.WebControls.Label lblSUBTITLE04;
protected System.Web.UI.WebControls.Label lblSUBTITLE05;
protected System.Web.UI.WebControls.Label lblSUBTITLE11;
protected System.Web.UI.WebControls.Label lblTABTITLE06;
protected System.Web.UI.WebControls.Label lblTABTITLE10;
protected System.Web.UI.WebControls.Label lblTABTITLE11;
// ??? ??
protected System.Web.UI.WebControls.Panel PN0;
protected System.Web.UI.WebControls.Panel PN1;
protected System.Web.UI.WebControls.Panel PN10;
protected System.Web.UI.WebControls.Panel PN11;
protected System.Web.UI.WebControls.Panel PN2;
protected System.Web.UI.WebControls.Panel PN3;
protected System.Web.UI.WebControls.Panel PN4;
protected System.Web.UI.WebControls.Panel PN5;
protected System.Web.UI.WebControls.Panel PN6;
protected System.Web.UI.WebControls.Panel PN9;
#region ? More ?? ??
private void ibtnTabMore01_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub01);
this.GetData(this.Key);
}
private void ibtnTabMore02_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub02);
this.GetData(this.Key);
}
private void ibtnTabMore04_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub04);
this.GetData(this.Key);
}
private void ibtnTabMore05_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub05);
this.GetData(this.Key);
}
private void ibtnTabMore03_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub03);
this.GetData(this.Key);
}
private void ibtnTabMore06_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub06);
this.GetData(this.Key);
}
private void ibtnTabMore10_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub10);
this.GetData(this.Key);
}
private void ibtnTabMore09_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub09);
this.GetData(this.Key);
}
private void ibtnTabMore11_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub11);
this.GetData(this.Key);
}
private void ibtnTabMore12_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// ?? DataGrid? ???? ? ???? ??
this.MorePageSize(this.dgListSub12);
this.GetData(this.Key);
}
#endregion
// ? ??? ???? ???
if (xd200010Set.XD280010S != null &&
xd200010Set.XD280010S.Length > 0)
{
this.dgListSub01.DataSource = CreateDataSource(xd200010Set.XD280010S) ;
this.dgListSub01.DataBind();
}
//???? ?
if (xd200010Set.XD110010S != null &&
xd200010Set.XD110010S.Length > 0)
{
this.dgListSub12.DataSource = CreateDataSource(xd200010Set.XD110010S) ;
this.dgListSub12.DataBind();
// ???? ?? & Tooltip ??.
foreach(DataGridItem item in dgListSub12.Items)
{
string rawStr = ((Label)item.Cells[4].FindControl("lblCTTDESC")).Text;
if(rawStr.Length > 200)
{
item.Cells[4].ToolTip = rawStr.Substring(0, 200) ;
}
else
{
item.Cells[4].ToolTip = rawStr ;
}
if( rawStr.Length > 34)
item.Cells[4].Text = rawStr.Substring(0,34)+" ...";
}
}
if (xd200010Set.XD210010S != null &&
xd200010Set.XD210010S.Length > 0)
{
this.dgListSub02.DataSource = CreateDataSource(xd200010Set.XD210010S) ;
this.dgListSub02.DataBind();
// ????, ??? ???? ?? & Tooltip ??.
foreach(DataGridItem item in dgListSub02.Items)
{
Label tlblSALENAME = ((Label)item.FindControl("lblSALENAME"));
Label tlblPRDID_ = ((Label)item.FindControl("lblPRDID_"));
string rawSALENAME = tlblSALENAME.Text;
string rawPRDID_ = tlblPRDID_.Text;
tlblSALENAME.ToolTip = rawSALENAME;
tlblPRDID_.ToolTip = rawPRDID_;
if( rawSALENAME.Length > 20)
tlblSALENAME.Text = rawSALENAME.Substring(0,20)+" ...";
if( rawPRDID_.Length > 20)
tlblPRDID_.Text = rawPRDID_.Substring(0,20)+" ...";
}
}
if (xd200010Set.XD220020S != null &&
xd200010Set.XD220020S.Length > 0)
{
this.dgListSub05.DataSource = CreateDataSource(xd200010Set.XD220020S) ;
this.dgListSub05.DataBind();
xd220020AMT = wsPurBill.ReadAMT(Key, QUERYUSER);
xd220020NAMT = wsPurBill.ReadNAMT(Key, QUERYUSER);
this.lblCNT2.Text = xd220020AMT.RCOUNT ;
this.lblAMT2.Text = xd220020AMT.TOTAMT ;
this.lblNCNT2.Text = xd220020NAMT.NRCOUNT;
this.lblNAMT2.Text = xd220020NAMT.NTOTAMT;
}
if (xd200010Set.XD220010S != null &&
xd200010Set.XD220010S.Length > 0)
{
this.dgListSub04.DataSource = CreateDataSource(xd200010Set.XD220010S) ;
this.dgListSub04.DataBind();
xd220010AMT = wsSaleBill.ReadAMT(Key, QUERYUSER);
xd220010NAMT = wsSaleBill.ReadNAMT(Key, QUERYUSER);
this.lblCNT1.Text = xd220010AMT.RCOUNT ;
this.lblAMT1.Text = xd220010AMT.TOTAMT ;
this.lblNCNT1.Text = xd220010NAMT.NRCOUNT ;
this.lblNAMT1.Text = xd220010NAMT.NTOTAMT ;
}
if (xd200010Set.XD230030S != null &&
xd200010Set.XD230030S.Length > 0)
{
this.dgListSub06.DataSource = CreateDataSource(xd200010Set.XD230030S) ;
this.dgListSub06.DataBind();
xd230030AMT = wsOrder.ReadAMT(Key, QUERYUSER, "CLIENT");
this.lblCNT4.Text = xd230030AMT.RCOUNT ;
this.lblAMT4.Text = xd230030AMT.TOTAMT ;
this.lblPOINT4.Text = xd230030AMT.TOTALPOINT ;
}
if (xd200010Set.XD230010S != null &&
xd200010Set.XD230010S.Length > 0)
{
this.dgListSub10.DataSource = CreateDataSource(xd200010Set.XD230010S) ;
this.dgListSub10.DataBind();
xd230010AMT = wsEst.ReadAMT(Key, QUERYUSER, "CLIENT");
this.lblCNT3.Text = xd230010AMT.RCOUNT ;
this.lblAMT3.Text = xd230010AMT.TOTAMT ;
}
if (xd200010Set.FILES != null &&
xd200010Set.FILES.Length > 0)
{
this.dgListSub03.DataSource= CreateDataSource(xd200010Set.FILES) ;
this.dgListSub03.DataBind();
}
if (xd200010Set.XD300010S != null &&
xd200010Set.XD300010S.Length > 0)
{
this.dgListSub09.DataSource = CreateDataSource(xd200010Set.XD300010S) ;
this.dgListSub09.DataBind();
}
//???? ?
if (this.xd200010Set.XD930010S != null)
{
this.dgListSub11.DataSource = CreateDataSource(this.xd200010Set.XD930010S);
this.dgListSub11.DataBind();
}
//??? ?? ?? ??
if (xd200010Set.XD990010S != null &&
xd200010Set.XD990010S.Length > 0)
{
this.hlADDLINK.Visible = false;
this.dlLINK.DataSource = CreateDataSource(xd200010Set.XD990010S);
this.dlLINK.DataBind();
}
else
{
WS950010.XD950010 xd950010 = null;
xd950010 = wsTableID.GetTableID("TB200010", this.QUERYUSER);
this.hlADDLINK.Text = "??? ?? ?? ??";
this.hlADDLINK.NavigateUrl = "../UI900/UI990070.aspx?TABLEID="+ xd950010.TABLE_ID ;
}
I should work with tons of code like THAT. Fantastic, isn't it?
|
|
|
|
|
Something about that reminds me of Cobol...
|
|
|
|
|
This is a nice convention I think I should use it on my next project
|
|
|
|
|
I don't think your company employs humans. Get out before they notice you're not one of them!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
And run away as fast as he can, I might add.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Pssst.. I heard that they are soon running out of the 6 digits names, and going to migrate them to GUID...
|
|
|
|
|
darkelv wrote: Pssst.. I heard that they are soon running out of the 6 digits names, and going to migrate them to GUID...
ROTFLMAO
|
|
|
|
|
At least it's consistent. That's the idea, isn't it??
|
|
|
|
|
Looks like built in obfuscation to me
Tosch
|
|
|
|
|
I seriously feel for you. I'm just glad your company's morons and our company's morons haven't gotten the chance to collaborate.
"I need build Skynet. Plz send code"
|
|
|
|
|
Wow...just wow. My Condolences. Thank you for making me feel better about my life though
|
|
|
|
|
Man, after reading that, my life is simply great!
---------------------------
Both optimists and pessimists are important in technology. The optimist invented the aeroplane; the pessimist invented the parachute.
Regards,
Hesbon Ongira
Nairobi, Kenya.
|
|
|
|
|
At least they are using Hungarian notation I guess ?
www.socoder.net
|
|
|
|
|
Sounds like somebody needs to be dragged into a dark alley
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Leave that environment as soon as possible .
And thank god they havn't used chines Symblos Instead...
Believe Yourself™ :->™
|
|
|
|
|
Holy crap. Inbuilt obfuscation.
|
|
|
|
|
I worked for a company many years ago that had the same type of moronic standard. They also had rules against nested loops & if's. They were too hard to read. You were supposed to break out the inner loop, stick it below the outer loop, then "goto" back into the upper loop. That was so stupid I didn't know how to respond.
Please give us the name of this company so I can make sure they are on my blocking list for my resume.
|
|
|
|
|
This code is self documenting, right?
|
|
|
|
|
mine is slightly better:
a,b,c,d,e,f,g,h,i,j... asdf and qwer as variables names.
|
|
|
|