Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Reflection Document

Assignment 1
CIS*3190
The Approach

This project has been a very efficient way for me to learn unique skills in fortran
and how to update code. I will talk about my original approach and how I altered it as I
went. I will also be talking about how I ended up doing the project and how I arrived at
my solution.

Originally I thought I could start learning fortran whenever I had some time. I did
this a couple times a week for the first two weeks and I still wasn't really understanding
anything. I decided at some point I would actually have to download the original Tic Tac
Toe file and start reading over it to try and understand the project. At this point I hadn't
even downloaded the gfortran compiler. I got the gfortran compiler downloaded and
stared blankly at it for some time before deciding I should probably start trying to
change it into something. After reading over the assignment page I thought I would
familiarize myself with some of the similarities and differences between fortran 95 and
older versions of it. Mostly all of what I had done so far, except read over the
assignment, had just confused me more. I finally had a night I could just sit down and
focus, so that’s what I did. I sat down and put the old code on the left and the new
program on the right, originally thinking that I’d copy and paste it and just change it a
little which did NOT work. I started fresh, a “blank slate” as they say. I thought that I
could start going through the original program and anything I didn't know I would skip
and comment in some pseudo code for when I come back and need to know what
should go there. I went in order of the main ideas in coding: variables, conditionals,
loops, functions. Once I arrived at this method of updating this code everything went
pretty smoothly. In my next section I will talk about how I actually coded this assignment
and any issues that went along with that.

The Coding

As I said, I worked through the code on a step-by-step basis. I first started with
variable names. I had no problems with this other than trying to create a 2D-array which
was easily fixed with a quick Google search. After declaring my variables, I worked on
print statements which is a fairly easy process since it isn't much different between the
two versions of fortran. One thing I did notice about reading input and writing to the
screen is that it doesn't pick up new line characters. I didn't bother looking this up, as I
just had multiple print statements which makes the code more readable anyway. The
third item I touched on was the conditionals. It did not take too much time as the syntax
was fairly straight forward. However, there was a couple of minutes that I had to Google
to find out some syntax for AND operations in an if statement and how the if else
statements were setup. The next thing I looked at were loops. This didn't take me too
much time since they were very similar to other syntaxes from other languages. The last
thing, and most complicated in my opinion, was the functions. This was probably one of
the hardest things I had to figure out. I was confused between the difference between
subroutines and functions, so after figuring out which one I wanted to use and when I
wanted to use it, I began working it out. I ended up using a mix of them. When I did not
have to return anything I used a subroutine, and when I did have to return a value I
would use a function. I ran into an issue when trying to send my 2D-array to the
functions, but after some picking and prodding I finally figured out that I needed to
declare my variable in the function/subroutine. After figuring out those four things it was
smooth sailing.

The Modernized Features

When I originally read through the code I was a bit confused, with all the GO TO
statements, all the numbers everywhere, the capitals, and most of all the strangely
indicated comments (the C as a #). After some deep analysis of the project I started
understanding what was going on. I began following the GO TO statements and trying
to figure out when to implement a function and when to implement a loop, as they were
used for both in the original code. I tried to modernize the tabbing of the program to look
more readable. The original program was not tabbed at all which made reading nested
loops and if statements very difficult to read.

I changed the original code to fortran 95. This means having to modernize a lot of
the print statements and syntax. I tried making helpful comments in the functions, and
rather than explaining all through the functions (making it hard to read) I tried to tell the
reader what was going to happen before reading the functions.

My View on Fortran

Fortran definitely has its downfalls, but it is not a terrible language. I went into this
feeling like I would have to spend weeks learning this cryptic language before even
attempting to read what is happening. I was pleasantly surprised when I got into coding
this program. I found that fortran 95 is extremely similar to other languages and even
the older code wasn't that bad. If not having taken assembly language this may have
been a different story, but I feel the language is not terrible. It’s intuitive once you have
placed yourself in the time frame, it’s extremely fast on run time, and it, if given the time,
can produce some great programs. I wouldn't go as far as to say it is better than some
of the more popular languages like C, Java, or C++, but I would say that if I had to write/
update some code in fortran I would not be scared or upset.
Would it have been easier to translate the program into a language such as C?

Yes I do think that it would be easier to translate this program to C. The only
reason for this would be because I have coded in C for 3 years and it is my strongest
programming language. If I were to approach this problem I probably wouldn't have
gone step by step in translating this program. Rather I would run the program,
understand what I have to produce, and code it.

Is there a better way of modernizing the program?

I believe there is a better way to modernize this program. I think that my


knowledge of fortran is not great enough to modernize it as well as it could be. I think
that if given another project to modernize I think it would become more and more
accurately modernized as I learn the language.

Given your knowledge of programming, was Fortran easy to learn?

As I said in my other sections it wasn't to difficult to learn fortran other than some
of the hiccups I encountered. The reason I think this is because it has all the same
things other programming languages have, such as C. This being functions,
conditionals, variables and loops. Fortran gave the ability for me to setup my program
much like a C program which made coding this project much easier.

What structures made Fortran usable? (In comparison to C for instance)

I have talked about this earlier in this reflection, but I found my knowledge in C to
be very transferable to fortran. Other than the syntax between write/read statements,
writing output and reading input was fairly straightforward. Other structures that made
fortran usable were the functions. After figuring out how to use them and how to pass in
variables they were a huge help in writing this program. In comparison to C, fortran held
up its own. The structures were very similar to C, although I would have wished to have
figured out if there are structs in fortran because this would have been extremely helpful
for a couple of the variables I continually passed back and forth through the functions.

You might also like