Pseudocode: a must-use tool for Computer Science

academics computer science pseudocode
By Hunter

My number one piece of advice for someone entering college and studying computer science is the following sentence: write pseudocode before writing your actual code. If you follow this piece of advice, you will save yourself hundreds of hours over the next four years of your life.

Pseudocode is a plain language description of an algorithm that will help you implement code across computer languages (Python, Java, C++, etc.). There isn’t a “correct” way to do it, but simply taking the time to write out exactly what you are trying to do with your code will save you lots of time down the road. An example of pseudocode for making a PB&J sandwich is:

// Go into kitchen

// Open pantry

// Grab peanut butter, jelly, and bread from pantry

// Open utensil drawer

// Grab a knife

// remove bread from bag

// Open peanut butter

// Spread peanut butter on 1 piece of bread using the knife

// Open jelly container

// Spread jelly on other piece of bread using knife

// Put 2 pieces of bread together to form sandwich

At this point, you may be thinking that pseudocode is a waste of time - you shouldn’t have to take the time to sit down and write instructions for yourself when you can just go into the kitchen and make a sandwich! However, as the complexity of a given task increases, you may need to take the time to think about how exactly you want execute a given task. For example, imagine that you don’t have any jelly: you start making your sandwich, spread all the peanut butter on the bread...and then realize you have no jelly! You leave the peanut butter and bread on the kitchen counter while you go out to buy jelly and, while you’re gone, your dog eats all your peanut butter and bread. If that's the case, you’ll probably wish that you had spent a little bit of time thinking about your entire process before beginning.

Okay, enough about PB&J.

By writing pseudocode, you can increase your chances of avoiding two time-sucking issues: debugging, and the “wrong turn” error. 

Debugging can be quite straightforward if you have an easily readable roadmap: when your code does not work, you can clearly and efficiently retrace your steps from start to finish to catch the error. It will be easier to distinguish between syntactical errors (i.e. misspelling of a variable) and errors in your logic (i.e. you put the pieces of bread together before spreading the jelly). 

Pseudocode also helps you navigate the “wrong turn” error. This error occurs when you spend hours building something before realizing that you have been going in the wrong direction the entire time. If you had taken the extra time to map out your entire process using pseudocode, then you would’ve saved yourself the hassle of beating your head against a problem that you should not have even been trying to solve in the first place.

I have made the error of just rushing into a project without thinking about the bigger picture too many times to count. If I had slowed myself down at the beginning and taken the time to write pseudocode beforehand, then I would’ve gotten a lot more sleep in college.

Hunter studied Physics and Computer Science at Harvard College. In 2019, the Chicago Cubs drafted Hunter, and he’s been playing pro baseball ever since.

Comments

topicTopics
academics study skills medical school admissions MCAT SAT college admissions expository writing strategy English MD/PhD admissions writing LSAT physics GMAT GRE chemistry academic advice graduate admissions biology math law school admissions ACT interview prep language learning test anxiety personal statements premed career advice MBA admissions AP exams homework help test prep creative writing MD mathematics study schedules Common Application computer science summer activities history secondary applications philosophy organic chemistry research economics supplements 1L grammar statistics & probability PSAT admissions coaching dental admissions psychology law legal studies ESL reading comprehension CARS PhD admissions SSAT covid-19 logic games calculus engineering USMLE medical school mentorship Latin Spanish parents AMCAS admissions advice biochemistry case coaching verbal reasoning DAT English literature STEM excel political science skills French Linguistics MBA coursework Tutoring Approaches academic integrity astrophysics chinese classics dental school gap year genetics letters of recommendation mechanical engineering units Anki DO Social Advocacy algebra art history artificial intelligence business careers cell biology data science diversity statement first generation student freewriting geometry graphing kinematics linear algebra mental health presentations quantitative reasoning study abroad tech industry technical interviews time management work and activities 2L AAMC DMD IB exams ISEE MD/PhD programs MMI Sentence Correction adjusting to college algorithms amino acids analysis essay athletics business skills cold emails executive function fellowships finance functions genomics information sessions international students internships logic networking office hours poetry pre-dental proofs resume revising scholarships science social sciences software engineering trigonometry writer's block 3L Academic Interest EMT FlexMed Fourier Series Greek Health Professional Shortage Area Italian JD/MBA admissions Lagrange multipliers London MD vs PhD Montessori National Health Service Corps Pythagorean Theorem Python Shakespeare Step 2 TMDSAS Taylor Series Truss Analysis Zoom acids and bases active learning architecture argumentative writing art art and design schools art portfolios bacteriology bibliographies biomedicine brain teaser burnout campus visits cantonese capacitors capital markets central limit theorem centrifugal force chem/phys chemical engineering chess chromatography class participation climate change clinical experience community service constitutional law consulting cover letters curriculum dementia demonstrated interest dimensional analysis distance learning econometrics electric engineering electricity and magnetism embryology entropy escape velocity evolution extracurriculars fundraising harmonics health policy history of medicine history of science hybrid vehicles hydrophobic effect ideal gas law immunology induction infinite institutional actions integrated reasoning intermolecular forces intern investing investment banking lab reports letter of continued interest linear maps mandarin chinese matrices