Re: Structured Coding



Michael Wojcik<mwojcik@xxxxxxxxxxx> 02/10/06 7:23 AM >>>
In article <45209mF4ia9nU1@xxxxxxxxxxxxxx>, "Frank Swarbrick"
<Frank.Swarbrick@xxxxxxxxxxxxxx> writes:
Michael Wojcik<mwojcik@xxxxxxxxxxx> 02/06/06 11:01 AM >>>
In article <44foukF1vhs6U2@xxxxxxxxxxxxxx>, "Frank Swarbrick"
<Frank.Swarbrick@xxxxxxxxxxxxxx> writes:
... This was using Pascal. I'm not even sure if Pascal has a goto
statement! (No, just kidding, I'm sure it does. We were just told to
not
use it.)

Standard Pascal does include goto, but it's deprecated...

Typically, goto is used in Pascal to escape from nested loops in the
event of an error.

Java has no goto statement proper, though it provides restricted
gotos that can only branch to certain locations (break and continue).

I like this quote from _Learning Java_:
"Multilevel break and continue statements remove the remaining
justification
for the evil 'goto' statement in C/C++".

Really? It's impossible to tell out of context (we don't know what
justifications remain, because we don't know which ones the author(s)
have eliminated), but it reads to me like a bit of idle demagoguery.

Bought a book on C# the other day. Has a surprising amount of good
stuff.

C#, or the book?

Sorry, I was referring to C# the language, not the book that I am using to
learn it.

I have two C# books at the moment, both by Jesse Liberty. _Programming
C#_ is a reference, and is OK, but somewhat out of date because
Microsoft is changing the language and even more so the APIs (and the
Visual Studio IDE, if you care about such things) rapidly. _Learning
C#_ I think was probably not worth my money. It's aim isn't clear;
it's not a proper introduction to programming, but it claims that its
audience includes new programmers, and it tries to teach such basic
concepts as arrays. It's not a large book and it devotes far too
many pages to elementary topics like that, and far too little to ones
of more interest to experienced programmers coming to C# (notably
what approaches are preferable for given situations, and why).

The book I am reading is _Programming C#_ (by Jesse Liberty) (hmm, looks
like I should have got it from amazon.com and saved myself $15.00...). I
like the book less than I like the language. It seems like some more
advanced concepts (such as classes, etc.) are addressed earlier than simpler
concepts (such as arrays and strings). Or maybe he just has a different
opinion on what is advanced and what is not. Still, I'm finding it fairly
useful. Not for a beginning programmer, though. And it sounds like
_Learning C#_ is not either. Not that I need that, but I'd be curious as to
what book a non-programmer might pick up to learn C# as a first language.
Or perhaps C# simply is not a "first language" at all? I'm personally not
convinced that any OOP language would be a good first language to learn.
But, then, it's hard to erase all these years of procedural programming and
picture what it would have been like to learn an OO language first. Is
there anyone out there who learned, say, Java first and then COBOL (or C, or
some other procedural non-OO language)?

(It's interesting to note that the Wikipedia [yes, I love Wikipedia] page
for Procedural programming refers to C++, C#, Delphi, etc. as being
procedural languages, even though they are also OO languages. I guess once
could certainly limit themselves to procedural programming only in those
languages, but I can't imagine anyone doing so.)

C# has a number of nice features; its main problem is that that number
is growing far too quickly. It's losing any hope it had of being more
elegant than C++.

It seems to me that it's rather difficult to have a language that is both
small enough to not be overwhelming to learn, yet large enough to be quite
powerful. Still looking...

However, it will likely always be better than C++.NET, which will
always be an awkward combination of a bloated, complicated standard
language and a wide array of proprietary extensions. Ugh.

Heh. I learned C++ back in the early 90s. Looking an Visual C++ it seems
like I would have to learn the whole thing all over again, so many things
have changed!

Now F#, *there* is a language for .NET programming...

I wasn't specifically looking for a .NET language. I just thought I'd take
a look at C#. Looking up F# I see that it implements functional programming
and has similarities to your apparent favorite, OCaml. I still haven't
really tried to learn functional programming, but it looks to me to be too
much like Calculus, which I failed three times, so...

Can't recall offhand if it has multilevel break/continue statements, or
something similar.

It doesn't, unless they've been added very recently. While C# is in
many ways closer to Java than it is to C++, this is one of the places
where it didn't pick up a Java feature. It also retains goto and
adds "goto case", which it uses to make C++'s default fall-through
(which C++ got from C) explicit rather than implicit.

I'm not fan of the C/C++ case "fallthrough". Don't think I've ever
intentionally utilized it. Seems to me it's more likely to cause problems
than it is to help clarify things.

Frank


---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
.



Relevant Pages

  • Re: object system...
    ... for that you need machine language. ... isn't even as fast as other systems programming languages. ... Stroustrup's stated design goal was to enable ... all manner of elegance or abstraction can be sacrificed for speed, ...
    (comp.object)
  • Re: 7drl starting announcement
    ... I ran a BBS for awhile in the 90s and was known around my area code ... I wasn't very sophisticated myself in the area of programming, though, ... I still use goto sometimes today just to solve little problems that I ... what we consider programming language without sophisticated use of the ...
    (rec.games.roguelike.development)
  • Re: DirectX in HLA
    ... I guess that you have a great knowledge of DirectX ... > understanding by looking at them in assembly language... ... > actually represents, really, is a means to "undo" the OOP so ... > is NOT an "OOPL" (object-orientated programming language), ...
    (comp.lang.asm.x86)
  • Re: DirectX in HLA
    ... I guess that you have a great knowledge of DirectX ... > understanding by looking at them in assembly language... ... > actually represents, really, is a means to "undo" the OOP so ... > is NOT an "OOPL" (object-orientated programming language), ...
    (alt.lang.asm)
  • Re: LSP and subtype
    ... What is the class of problems solvable using UML? ... the language of physics cannot describe. ... whatever paradigm equivalent to 2GL/3GL ... there is still a great need for reuse and generic programming. ...
    (comp.object)