hi

J

John W. Kennedy

Oliver said:
What about:

PERFORM
READ A-FILE
AT END
MOVE "YES" TO A_FILE_EOF
NOT AT END
NOTE Process the record
END READ
WHILE A-FILE-EOF NOT = "YES".

?

I'm not sure how "standard" this is, but I believe this works on both Liant
RM/COBOL and ILE COBOL400.

NOT AT END is certainly not standard pre-1985 COBOL.
 
M

Martin Gregorie

Chris said:
Martin said:
The layout standard I've seen that I really don't like is the custom of
declaring class-level variables after the methods. Why reverse the
standard used inside blocks and methods other than sheer perversity?

I used to do that; I have since reconsidered, but I can speak as a reformed
sinner...

I take it that you wouldn't want to see methods and fields interleaved (at
least, not except in very special cases) ? If so then either the fields go
first or they go last (or possibly both if you split public fields from other
fields). Now it's also fairly normal to want to put public members before
private ones[*]. So, fields, being private, don't go before the public
methods...

So they have to follow /all/ the methods. Simple!
The reasoning certainly makes sense.

I tend to use the public/protected/private order, first for constants,
then variables and finally for methods, so I suppose that's a
semi-consistent way of doing it while still preserving the data
declaration before code ordering.
 
M

Martin Gregorie

nukleus said:
If variables are declared at the top of the methods,
then all the error conditions and variable values
could be seen if you set a breakpoint in correct place
cause they won't go out of scope.
Fair point.
I absolutly hate "code reviews".
It simply means that there is some smart ass,
sitting on the top of a bunch of dummies,
telling them how screwed up they are,
and all it produces at the end
is guilt, leading to fear
to lose onse skin.
I don't like them either, but some organizations like them, especially
when they have a high proportion of new grads to knock out the code.

My worst case: the project's Technical Manager defined the coding
standards - basically standard K&R layout and naming conventions (it was
an ANSI C project) - and then went on holiday. Meanwhile I'd finished
detailed design and three of us had written and tested the project's
specialized function library, which included an in-memory active data
dictionary. At this point the Tech Manager returned from holiday and
re-issued the coding standards. Somebody must have dropped him on his
head while he was away because he now mandated Hungarian Notation
(Microsoft's poison gift to the world). I hit the roof because we had no
time or resource to rewrite the library code. The Project Manager should
have canned the new standard, but instead said we were both right. The
end result was that everybody else wrote horrible hungarianised code
while I and the other technical designers wrote to K&R standards.

The moral of this is: NO radical changes to project standards once
they've been issued. EVER.

In fact we didn't use code reviews on that project despite having a
large grad coding population, but we did require them to write module
specs in pseudo code and we reviewed that to make sure they had
understood the tech spec. That worked well and the end result, a large,
scalable multi-process system had no gross functionality, control or
interfacing problems.
Then, after contructor code, i like to put the highest,
possibly thread level methods, such as start, stop, run,
Terminator (ever heard of such an animal), and things
like that.
I put main() (if there is one) first, but if there's a main() the
probably are no constructors. Then I put public methods followed by
protected and private methods. Within each group of methods they're
simply in alphabetic order for ease of reference within the source file.
 
M

Martin Gregorie

Oliver said:
What about:

PERFORM
READ A-FILE
AT END
MOVE "YES" TO A_FILE_EOF
NOT AT END
NOTE Process the record
END READ
WHILE A-FILE-EOF NOT = "YES".
That's essentially my first example give or take a few reserved words
which I could well have got wrong: I haven't written any COBOL (apart
from the wildly deviant Tandem Screen COBOL) for over 10 years, and on
that project most of my input was in C (a conversion process to map SNA
LU6 sessions onto TCP/IP sessions in case you wanted to know).
 
N

nukleus

Martin Gregorie said:
Fair point.

I don't like them either, but some organizations like them, especially
when they have a high proportion of new grads to knock out the code.

My worst case: the project's Technical Manager defined the coding
standards - basically standard K&R layout and naming conventions (it was
an ANSI C project) - and then went on holiday. Meanwhile I'd finished
detailed design and three of us had written and tested the project's
specialized function library, which included an in-memory active data
dictionary. At this point the Tech Manager returned from holiday and
re-issued the coding standards. Somebody must have dropped him on his
head while he was away because he now mandated Hungarian Notation
(Microsoft's poison gift to the world). I hit the roof because we had no
time or resource to rewrite the library code. The Project Manager should
have canned the new standard, but instead said we were both right. The
end result was that everybody else wrote horrible hungarianised code
while I and the other technical designers wrote to K&R standards.

The moral of this is: NO radical changes to project standards once
they've been issued. EVER.

In fact we didn't use code reviews on that project despite having a
large grad coding population, but we did require them to write module
specs in pseudo code and we reviewed that to make sure they had
understood the tech spec. That worked well and the end result, a large,
scalable multi-process system had no gross functionality, control or
interfacing problems.

I put main() (if there is one) first, but if there's a main() the
probably are no constructors. Then I put public methods followed by
protected and private methods. Within each group of methods they're
simply in alphabetic order for ease of reference within the source file.

Alphabetic order?
Never heard of such an animal.
I use cut'n'paste style of programming if you ever heard.
:--}

So, when I look at some code and, all of a sudden,
realize it could be done better by moving some of it
to a dedicated method, I simply make up a name of method,
put a call to it just where the old code was,
copy that call and insert it at the top of old code,
and then cut a bunch of old code out
and paste it just before the old method.
The next thing i do is to try to compile and it shows
me all the variables that are missing.
Zo...
We just cut and paste those from the old code to
the very top of new method.
If the old method conc out because now it does not
have its old variables, we look at that animal
and see where critical points are,
and so it weiks like a champ.
Just a couple of minutes
and you have a brand new method
that could be used by other boogers
cause that is the whole point of it,
to make it more universal and more structured.

But ALPHABETICAL sorting?
Maaaaan.
You can get into the Guiness book of werld records fer dat!

good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Hi everyone! 4
Hi! 0
Hi, I need some advice please. 3
My Status, Ciphertext 2
Looking For Advice 1
Hi! 0
how to create a webservice using java on eclipse? 2
How do i set specific code where in arduino 1

Members online

No members online now.

Forum statistics

Threads
473,785
Messages
2,569,624
Members
45,319
Latest member
LorenFlann

Latest Threads

Top