Mark
Fri May 07 04:29:19 CDT 2004
yeah your right. My mistake -I meant use camel casing for locals (not
Hungarian -getting confused between the two!), currently use Hungarian for
controls. As i said in my argument the prefix aint necessary in a type safe
environment.
End of the day as you suggest, one mans muck is another mans treasure, so as
long as a standard works for one person it is better than no standard at
all.
However this has been bothering me for some time now because in the .net
days of interoperation between code, it makes sense that there should be a
complete standard to simplify the design and development process of code
between .NET programmers of today -and lets hope in 10 years time.
Must admit Im not completely convinced with Hungarian for controls and your
point is right on the money, the only thing that is swaying it at present is
that it is easier to find them in the designer using intellisense.
*Patrick please see one mans view on this link -it covers most things (and
is obviously open to modification to suit your ideals)
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=336#10
--
--
Br,
Mark Broadbent
mcdba , mcse+i
=============
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:ufOqJk7MEHA.3292@TK2MSFTNGP11.phx.gbl...
>
> "Mark Broadbent" <no-spam-please@no-spam-please.com> wrote in message
> news:OckOl54MEHA.2540@TK2MSFTNGP10.phx.gbl...
> > whilst I am no expert, let me make a few comments.
> > You could use the goto statement (with a label to jump to) however this
is
> > usually necessary when the code is bad.
> >
> > From your code snippet it is very hard to see exactly what you are
trying
> > to
> > do but the chances are you could do a secondary && test within the while
> > loop -either moving the if statement test itself, or if that is not
> > possible
> > setting a boolean flag
> > e.g.
> >
> > bool loopFlag = true;
> > while (intCurCategory < intTotalCategories && loopFlag)
> > {
> > for (intPageIter = 0;intPageIter< ITEMS_PER_PAGE;intPageIter++)
> > {
> > if (intPagesDisplayed>ITEMS_PER_PAGE)
> > loopFlag = false;
> > break; //this will break the for loop
> > intPagesDisplayed++
> > }
> > }
> >
> > The other thing that strikes me about the code is the god awful naming
of
> > the integers. Ive been banging on for a while in the CSharp newsgroup
> > about
> > the lack of a firm standard when naming private variables , controls
etc.
> > And I intend to put this right myself sometime because it's something
that
> > I
> > believe slows down development time cos you are constantly thinking
"what
> > shall I call this". I think the general consensus is that for private
> > variables you should name them in Hungarian format (as you did) , but
you
>
> I wouldn't suggest talking consensus on this issue. Its actually probably
> pretty split. I for one hate hungarian and I'm not alone. Its a bad
standard
> and, IMHO, it turns good code into nearly unreadable rubbish. Well named
> variables will pretty much always remove the need for any prefixes, be
they
> scope or type. We have probably argued the issue before, I've been
involved
> in a couple of the naming convention debates, but I still think its
> irresponsible to decide what the consensus is off the cuff. Let the OP
look
> around and find all of debate on the issue, if he cares to do so, and let
> him draw his own conclusions. Beyond that, let him write his code as he
> wishes, he may think your variable naming is godawful as well.
>
>
> > For my form controls however I am currently of the opinion to prefix
those
> > (a la VB format) since it makes my life easier finding them using
> > intellisense however I have had one expert tell me he doesnt do this
> > either!
>
> I still prefer well named variables, although I do do this oftentimes with
> textboxes. I prefer
> customerNameTextBox to txtCustomerName, however they both have a major
> flaw...they convey incorrect information if the text box is changed to a
> combo box. In some cases it isn't a big deal, but the hungarian notation
> bites you if you don't change it. txtCustomerName better be a text box,
not
> a combo box or your variable name is wrong. It gets trickier when you
throw
> in 3rd party controls...treeCustomers may be a standard TreeView, or it
may
> be DevExpresses TreeList, or it may be something else entirely. The name
> treeCustomers implies TreeView, but often enough its wrong. This shows a
> major problem with hungarian, sometimes the variable names imply both a
type
> and a use and cross eachother up doing it. I've been trying to find a
> better naming scheme for this that increases freedom and reduces the
> confusion, but I havn't so far. You always seem to add the name of the
base
> control type to the variable. Hopefully refactoring will solve what naming
> conventions can't seem to, in this case.
>
> >
> > I hope some of this helps! Good luck.
> >
> > --
> >
> > Br,
> > Mark Broadbent
> > mcdba , mcse+i
> > =============
> > "Patrick" <patl@reply.newsgroup.msn.com> wrote in message
> > news:eFqU8i4MEHA.2976@TK2MSFTNGP10.phx.gbl...
> >> How could I break out of the while loop within the for/if loop below
> >>
> >> while (intCurCategory < intTotalCategories)
> >> {
> >> for (intPageIter = 0;intPageIter< ITEMS_PER_PAGE;intPageIter++)
> >> {
> >> if (intPagesDisplayed>ITEMS_PER_PAGE)
> >> break; //trying to break out of the while loop
here!
> >> intPagesDisplayed++
> >> }
> >>
> >> }
> >>
> >>
> >
> >
>
>