JA4. Learning Journal Week 4¶
Statement¶
The Learning Journal is a tool for self-reflection on the learning process. In addition to completing directed tasks, you should use the Learning Journal to document your activities, record problems you may have encountered and to draft answers for Discussion Forums and Assignments. The Learning Journal should be updated regularly (on a weekly basis), as the learning journals will be assessed by your instructor as part of your Final Grade.
1. Describe what you did, You need to describe what you did and how you did it¶
As usual, I started the week by trying some of the self quizzes which gave me an insight about what to expect. I then read the reading assignments, answered the discussions questions and here I am writing the learning journal. The topic of this week was about Control Structures and Subprograms.
The topic of Control structures and subprograms, included defining various structures like sequence, selection, and repetition. It also included defining subprograms and their types (functions and procedures), recursions, passing by value and passing by reference.
2. Describe your reactions to what you did¶
I enjoyed the video lectures of this week more than the reading assignments as the topics were complex and the videos were more interactive and easier to understand and follow. The discussion assignment asked about defining recursion and the difference between passing by value and passing by reference, and how passing by reference can be a security issue.
3. Describe any feedback you received or any specific interactions you had. Discuss how they were helpful¶
I did not receive any interesting feedback that worth mentioning.
4. Describe your feelings and attitudes¶
Passing by reference is a security thread, but it is a very powerful feature that can be used to pass large objects without copying them, but it can also the source of most obscure bugs.
The paradigm of the programming language used affects the way your program passes value; for example, Javascript passes objects references by default, which means to pass by default you have to more manual work to copy the object (considering the nested objects).
Other more powerful languages allows you to choose between the two methods of passing easily, like C++ which allows you to pass by value or by reference using the &
operator or the *
operator.
5. Describe what you learned¶
As mentioned above, I learned about the difference between passing by value and passing by reference, and how passing by reference can be a security issue. We also learned about Sequence, Selection, and Repetition control structures, and how they are implemented in different programming languages.
Sequence is the default which means that the running program is executed line by line. Selection is the branching of the program based on a condition, and Repetition is the looping of the program based on a condition.
6. What surprised me or caused me to wonder?¶
The difference between procedures and functions, as I always thought they are the same thing, where the term procedural and functional programming languages are used interchangeably. The§y are different in the sense that functions return a value while procedures do not, however, from my knowledge, I know that procedures usually do multiple things while functions are usually smaller and do one thing; where a procedure body calls multiple functions.
7. What happened that felt particularly challenging? Why was it challenging to me?¶
Recursion is such an important concept that is used everywhere from programming to mathematics, and it is a very powerful tool that can be used to solve complex problems. However, it is a very hard concept to grasp, and it is very easy to get lost in the recursion. Every time I understand recursion, I feel like I am understanding it for the first time; then I forget it again, and feel completely lost when reading about it again.
8. What skills and knowledge do I recognize that I am gaining?¶
The difference between functions and procedures, and the difference between passing by value and passing by reference is some of the topics that I feel this week I gained a better understanding of.
9. What am I realizing about myself as a learner?¶
I am realizing that I understand recursion but lack of understanding of the problem itself is the barrier between me and recursion. I also realized that I was coding procedures thinking that they are functions.
10. In what ways am I able to apply the ideas and concepts gained to my own experience?¶
I work with Javascript a lot, which utilizes passing by reference heavily, and we tend to focus on functional programming concepts in our organization; it is good to know the concepts and how difficult is to apply functional thinking in an imperative language like Javascript.
11. Describe one important thing that you are thinking about in relation to the activity¶
I tried to implement towers of Hanoi problem using iteration first, and recursion second. My attempt did not work as expected; I was stuck in infinite loops at various places of my program; but it was a good exercise that costed me a 12 hours of my time.
References¶
- Ben-Ari, M. (2006). Understanding programming languages. Weizman Institute of Science.
- UoPeople. (2023). CS4402: Comparative Programming Languages. Lecture Notes Unit 4.