Pro-tips
This chapter will teach you some useful tricks that all computer science students should know.
When you don't know how to program something
The first thing to do is search for it on Google, Duckduckgo or similar web search sites.
Writing good searches
This may seem like a joke but a good estimate would be that over half of all new students have issues finding answers online. It is easy to get low-quality results but you can take a few steps to ensure that you get mostly good-quality results.
Before we begin, keep in mind that you will get much better results if you search in English, compared to any other language.
First, we have to decide what we want to know. As an example, suppose we would like to know how to reverse a list in python. Good searches are usually in the form <what you want> <language or program you want to use>
. So for our example, we might search for How to reverse a list in python
. This is more verbose than it has to be and reverse list python
works just as well.
If possible, search directly on sites that are known to have good results. For example, Stackoverflow is a place where developers can ask questions and everybody can answer, think of it as Wikipedia but for questions related to programming. While the answers are curated by experienced programmers you still have to be skeptical and understand that most programming answers are good enough rather than strictly correct and you will most likely have to adapt the solution to your specific problem.
Finding good search results
There are countless sites offering programming advice. Avoid sites that look like news articles or have short sentences. These are usually either computer-generated or written to rate high up on search results. If possible try and find the official documentation. Remember that you can use !kbd[!ctrl+F] to find content on the page.
Official or high-quality sources
- Stackoverflow (and other sister-sites)
- Hoogle, search haskell functions
- MDN, web technologies such as HTML, CSS, Javascript
ChatGPT and other AI services
In recent years, the usage of AI assistants in the field of computer science has truly exploded. Several options are available, all of which can assist you in your programming. Asking a chatbot a question such as "Write a program that calculates X digits of pi in Python" can provide a useful scaffold for your own code.
However, AI tools also come with risks. Most courses expect you to be able to program, write, and demonstrate your engineering skills without AI tools. They are rarely allowed during exams and only sometimes permitted in labs. If you are unsure whether you are allowed to use them, ask your teacher. Using tools that are not permitted by the examiner could result in suspension from your studies!
It is easy to write code that looks good, especially for inexperienced programmers. However, upon further inspection by an experienced examiner, it could be obvious that it was written by AI. At the very least, you are expected to fully understand how the code works and behaves.
AI is however a very powerful tool. For example, the text above was drafted by the authors and then rewritten for coherence and structure by ChatGPT!
Although usually helpful, sometimes AI can get things very wrong. Your calculator won't correct you if you wrote the wrong number and will isntead happily output the answer, not knowing that the inputs were bad. AI work the same way but works on language instead of math.