Closed kytrinyx closed 2 years ago
So, where do I learn how to make exercises in general? Do I need to download exercism to my machine?
Hey @TriAttack238 I think this link might help: https://exercism.org/docs/building/tracks/new/add-first-exercise
Thanks!
Wait, can you create and run a function in COBOL without having to put it inside of the procedure division of the main program?
In any case, I’ll be right on these initial exercises when I have the time.
AFAIK that's not possible with COBOL, you need at least the ID division and the procedure division.
Oh man that’s going to be one big stub.
I think we can make it work, well find a way. It is different from anything else so it's really worth it to teach this, even if it's just to give a different perspective.
Let’s just warn the students not to touch any capitalized words at the start.
One way would be to make a static identification division that's used for every exercise.
And the code that the user writes would be concatenated to it.
Or we teach the students about the divisions and that they're necessary.
And warn them about removing it, like you said.
It's also worth it to note that modern COBOL doesn't require capitalized keywords, so warning the students about those might not work.
Another issue would be which format do we teach to the students on this track?
COBOL has fixed format and free format.
Fixed has very specific rules of where certain things should go, like line numbers, comments, divisions and sections.
Free is more like modern languages, where you don't need to explicitly write line numbers and it's more relaxed on indentation rules.
Speaking of that I should also work on a COBOL highlightjs package.
It's also worth it to note that modern COBOL doesn't require capitalized keywords, so warning the students about those might not work.
But capitalizing keywords is still in best practices. For example in the Python track constants are taught with capitalized names, even though Python doesn’t actually have constants.
That's true, but I'm afraid of it being best pratice in COBOL due to legacy systems being written in all uppercase rather than it being better to write that way.
Python uses uppercase for constants to differentiate between normal variables, that makes it easier to find constants.
We could teach that COBOL is case insensitive and explain why they would want to write it in uppercase, to give the students an option on how to write it.
Another issue would be which format do we teach to the students on this track?
COBOL has fixed format and free format.
Fixed has very specific rules of where certain things should go, like line numbers, comments, divisions and sections.
Free is more like modern languages, where you don't need to explicitly write line numbers and it's more relaxed on indentation rules.
I’m aware of the differences, but it’s a tough question. I personally prefer free, and it’s in the standard, but it would make older code harder to understand if it’s learned first. However, unit tests technically only care about the result, not how, so it might be possible to talk about both.
However, unit tests technically only care about the result, not how, so it might be possible to talk about both.
Yea we should talk about both. If they encounter COBOL in a real world situation it's possible it'll still use fixed format.
Something else to iron out is if we’re making this a learning mode course we need a track of concepts that creates a smooth learning curve and makes sense.
Maybe we could teach according to the order of the divisions like this?
identification division... environment division... data division... and then procedure division...
Not sure if that would make sense for a new student though.
No, I don’t think so, that would be like having a driving class and starting by talking about the history of roads. The course should get the students to start doing things as soon as possible. We’re trying to avoid the mistakes of the book here.
That's true. So do we start with the procedure division and explain things as they are needed along the way?
identification division.
program-id. hello.
procedure division.
display "Hello, World!".
stop run.
This is how would it would look like if we start with free format for the hello world.
Not quite that broad. If you look at the syllabi of the learning languages, they focus on specific features: strings, floating point numbers, lists, classes. So we should think on a more granular level:
-Basics(variable declaration, the MOV operation -numbers(fixed point computing, mathematical operations) -floating point numbers -string handling(https://www.tutorialspoint.com/cobol/cobol_string_handling.htm) -edited pictures -group data items -tables(arrays)
And the harder ones: -sequential file processing(record buffer, control breaks) -objects
I don’t think it’s necessary to get into stuff like pointers or indexed records, but they would be advanced concepts.
That sounds good, so we should start with the basics first?
Yes
identification division.
program-id. exercism-variables.
data division.
working-storage section.
01 ws-var pic x(13) value "Hello, World!".
procedure division.
display ws-var.
stop run.
This is how a hello world would look with variables.
But it would be in a function the returns the literal right? That’s what the page says.
It would be too confusing for students to start with user defined functions. They have their own divisions as well.
Then just have a stub with all that stuff in the first exercise
If you look at the website, every track starts with a complete function returning “Goodbye, Mars!” the student changes to “Hello, World!”. So, we just do that in COBOL
every track starts with a complete function returning
Issue is that COBOL user defined functions would be too complex for starting students who don't understand COBOL. We can start with the basics first, COBOL procedure division can be considered a C-like Main function.
If you use procedure division returning ws-variable.
it returns a value, but that's not needed if we're just displaying "Hello, World!".
But we don’t need to teach the syntax for the first one, the first exercise is changing the returned literal and that’s it. I think the return part is crucial for unit testing. Just log onto a track and check.
But yeah if we can trim it down that still works.
Hmmmm we can try, I'll see if I can make a working user defined function program. I'm afraid of scaring people when they see it hahah.
Excited to see this underway. Thanks everyone!
Some cc's:
I've also enabled Pull Requests as a requirement in this repo as there's multiple people working on it..
Also, it'd be great if you'd organise a chat with @jonathandmiddleton to get to know your way around Exercism's community of maintainers.
But yeah if we can trim it down that still works.
IDENTIFICATION DIVISION.
FUNCTION-ID. EXERCISMFUN.
DATA DIVISION.
LINKAGE SECTION.
01 LS-VAL PIC 9(1) VALUE 1.
PROCEDURE DIVISION RETURNING LS-VAL.
DISPLAY "Hello, World!".
GOBACK.
END FUNCTION EXERCISMFUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY. FUNCTION EXERCISMFUN.
PROCEDURE DIVISION.
DISPLAY FUNCTION EXERCISMFUN()
STOP RUN.
This is an example of a used defined function in COBOL, I'm sure it could be written in a better way, but documentation on this is really really bad at explaining how exactly it works. The function is the first thing there and it displays "Hello, World!" and returns 1. The second thing is for calling that user defined function.
I tested it with gnuCOBOL and it works.
This is another reason why we really need to build this Exercism track, COBOL documentation is not really that good right now.
Hey @iHiD, thanks for joining us here.
I'll certainly ask @joshgoebel about how HighlightJS works, currently there doesn't seem to be a package for COBOL Highlighting for HLJS. Maybe he could help us with that?
I'm in UTC+8 and still at breakfast. I've been praying for a time such as this. I will get back to you all later in the day.
Hey @axtens, thanks for joining us.
Time to make some good and easy to understand COBOL documentation? Can't wait to see this working on Exercism.
I mean, if COBOL is like English, then we just need to make an English textbook. That’s not too hard, right?
Might not be that simple, it would be like making a complete English textbook when all current English textbooks are not complete or don't explain things clearly.
That’s when we consult the giant book(the standard).
Oh yeah, is there a way to have "debrief" documents? COBOL has a lot of aspects where you can follow the book and do a thing but not understand at all what happened. For example, the "hello world" assignment will have quite a bit of writing that a student may want an explanation on, like the whole concept of divisions and sections.
In any case, I've started to learn markdown in full.
Edit: Alright, got the basics down.
I'm working on the highlightjs package. This might take a while.
But this made me realize how many keywords are actually non-standard. A lot of tutorials and videos use keywords that are not present in the standard.
Interesting. Tomorrow I'll try to figure out the first test in my own branch. What testing framework are we using again?
@TriAttack238 I think it's this one: https://github.com/openmainframeproject/cobol-check
Hey @axtens, is this the testing framework that we'll be using?
That's the one. If you join #maintaining-cobol in Exercism' s Slack you can discuss that decision with Sven
This issue helps keep track of the tasks you're working on towards launching this track.
The next steps are:
Once you've finished a task, you can check them in this list.
Questions
Please ask if you have any questions or if anything is confusing!