Course Survival Guide

From 22101
Jump to navigation Jump to search

Introduction

Completing your studies at the Technical University of Denmark will earn you the title “Engineer”. An engineer is assumed to have passed a series of courses covering core engineering competencies, one of which is basic programming.

But why should you learn basic programming? Technology development within the biotech- and pharma- industries and research has resulted in a data output far surpassing what standard tools such as Excel is able to handle. This calls for specialized tools and even if you do not pursue the computational branch of bio-engineering, then having a basic understanding of how such tools work will greatly improve your ability to interact with data stakeholders, thereby increasing your value to future employers. Furthermore, you will be taught computational thinking, which in essence trains you to break down large complicated problems into smaller manageable and solvable parts. Lastly, in an increasingly digital world, engineers are expected to understand the interaction between technology and society and this is to a large degree mitigated by programming.

“22101 Introduction to programming in Life Science using Python” is the bio version of basic programming. In this course, you will be taught basic programming using the language Python. These aspects will be covered:

  • Knowing the language - the reserved words, the syntax
  • Understanding the problem to be solved
  • Being able to to envision a strategy/method that will solve the given problem
  • Ability to translate a method into python code

How to make it through the course

Computers are ignorant and mechanical, they can do nothing unless a human has instructed them to do so. In order to be that human, you must learn to speak a language, which a computer can understand. There are several languages and for this course, you will learn the Python language. However, learning a new language is challenging, you will have to learn the language structure, special words forming the syntax and functions and how they are combined to form the grammar of the Python language - The code.

The saying “Practice makes perfect” very much applies here. As you go through the course, it is important that you actively write and run code to build an understanding of how things work. Making your own coding experiments in addition to the mandatory exercises will be valuable.

Hint: Knowing the language well will help in all other aspects of programming - both in finding methods, and making code.

Deciphering a computational problem

A key component of this course is to expose you to real world problems and then teach you to analyze the problem, break it down into manageable parts and then produce a programmatic solution. When deciphering such a computational problem, it is important to distinguish between A) not understanding what has to be achieved and B) not understanding how to achieve it. In the following sections, I will elaborate on this.

Not understanding what has to be achieved

Carefully reading and analyzing the text describing the problem is key to achieving the insights needed to work with the problem. It can sometimes be useful to problem text more than once before you decide on an approach. Examining the input files closely is required, just like having a good grasp on the desired output is essential. Take a mental step back and consider the larger context in which the program should be used - search for meaning. If the problem is still not clear, ask for input from the course instructors.

Not understanding how to achieve it

This is where you will build and eventually harvest your experience. Here, talking to your fellow students is very useful and in discussing you will mutually learn in that vocalizing your thoughts forces you to be concrete and this is the first step towards a solution.

A simple example: Given a list on a piece paper of different numbers, find the biggest number. A standard human approach to solving would be: Glancing at the list, identifying the biggest number. There will be some that catches your eye, and you simply choose the biggest one. This is a very intuitive description, and it solves the problem, but it does not really go in detail about HOW the problem was solved. Again, a very standard human reaction is that since the problem was solved successfully, there is no real need to think more about it.

When solving a problem, we almost always make a lot of mental shortcuts (reference 1, reference 2). Unknowingly, we are making assumptions, drawing conclusions, filling in gaps with convenient data or not realizing the gaps in our solution. We have solved the problem, but did we realize the details of the solution? The completeness of the solution? Or even the rightness of the solution?
In any case, we are using many "small" intuitive ideas/approaches in the solution, and since we are all individual persons, we are not thinking in the same way - we are using different mental shortcuts. The ability to elevate from this and produce one simple but powerful method rather than a plethora of small unique tricks is what we need to achieve.

What can be done to help this process of thinking about HOW to solve problems? When having a programming problem, where you cannot identify the relevant method, try to put the problem into the physical world. This is the world we are used to act in - it is at a lower abstraction level of thinking. Using the example, make a paper, maybe even several papers filled with numbers. Now try to find the biggest one. Due to the immensity of the task, you can no longer "just do it", but this problem is still a problem you can solve given enough time and patience. During the act of finding the biggest number, you naturally start thinking systematically about it. This is when you can most easily think about HOW you actually solve the problem. Observe your own actions. Become aware of the steps you take to get to the solution. Start over if you do not get into sufficiently deep details. How do you know? You still can not explain how you start the process, how you continue the process, how you end the process. Again, the ability to vocalize your problem forces concreteness.

As can be seen, you are not directly taught HOW to find methods to solve problems - if we knew a quick way to do that, we would revolutionize teaching. We are training you to gain insight in your own thought processes when solving problems, and to externalize these thoughts into a method/strategy. This is done by exposing you to a lot of problems to solve programmatically. You will learn some strategies for solving frequently occurring sub-problems, but every problem is different and there is no one-size-fits-all strategy for solving it. Rote learning can be good for learning the syntax and grammar of Python, but flexibility, imagination and the ability to see a problem from several angles will help in finding methods to solve problems.

Translating method into code

Once you have arrived at a suitable method, it should be translated into concrete code. This can be challenging, perhaps your method is still not entirely clear and detailed enough? Maybe you can sketch your ideas for a solution in a piece of paper or similar? Try coding your solution, if you are stuck, then it can sometimes be useful to delete your first attempt, you will have learned something, which may ease your second attempt. Talk to your fellow students, maybe you have worked on a similar problem in another exercise?

As a rule-of-thumb, you should identify what you want to do and how before starting to write code. The issue here is that you try to find a method while you are programming it in code. You have to remember all the nitty gritty details of the syntax of the language, the functions you use, the spelling, etc. while at the same time you try hard to identify a suitable method for solving the given problem. No wonder you have a hard time - do one thing at a time, do not split your focus.

When you get stuck

Try to find another method, if this is where your problem is. Try to implement (code) it in a different way. It very often happens that you start to think in one direction, and that direction forces you to make choices or follow patterns that you do not like or even see. Take a break. Consider other angles or possibilities. Another path can open for you, but only if you look.

A simple example can be that you make a loop, and by habit (i.e. not considering the possibilities and outcomes) you choose a for loop. But while loops also exists, and maybe you can gain benefits from using that instead.

Another situation can be you are trying to achieve/solve too much much at the same time - are you working with two concepts/goals in the code? You have to realize it first, but split it up when you discover it. A concrete example of this is reading a file and trying to compute on the data you read while you read them. Split it up in reading the file and getting the data, then compute on the data.

Students have given the advice to go through the material you have learned until now, when stuck. Check if there is some method, function or technique you might have forgotten or overlooked, which will help you.

I hope you found this useful. Remember to be present at the lectures and actively use and get input from the instructors and last but not least - enjoy it, coding can actually be quite fun and challenging!