class: center, middle, title-slide # CSCI-UA 102 ## Data Structures
## The Art of Code Reading .author[ Instructor: Joanna Klukowska
] .license[ Copyright 2025 Joanna Klukowska. Unless noted otherwise all content is released under a
[Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
Background image by Stewart Weiss
] --- layout:true template: default name: section class: inverse, middle, center --- layout:true template: default name: poll class: inverse, middle ## Poll
--- layout:true template: default name: breakout class: breakout --- layout:true template:default name:slide class: slide .bottom-left[© Joanna Klukowska. CC-BY-SA.] --- template: slide ## Why do I need to read code - understanding existing code base - debugging skills - code review - learning new things - code interviews --- ## Process of reading a new codebase - __get a big picture__ - run the code if possible to see what it does, understand the purpose of the whole program and its general behavior -- - __understand the structure__ - look at the files, how are they organized, what do they contain where is the entry point for the program, if available, read the top level documentation for each file/class -- - __study the overall logic__ - look at the _big_ code blocks and functions, what is the flow of the program -- - __dive into details__ - start reading functions and code blocks more carefully, determine data structures that are used, figure out any parts that are unclear -- - __test-drive the program__ - once you understand more of the code, run the program and try to break it, what assumptions does it make about the _outside world behavior_, are there situations that it cannot handle -- - __analyze the performance__ - think through data structures and algorithms to analyze overall performance of the program, can things be improved or optimized -- - __study each piece__ - analyze each class and function, can they be used outside of the context of this program, how, what issues might come up if they are --- ## Things that may help - take notes - draw diagrams - read the available README files and documentation (both class level, function level and inline) - write questions about parts you do not understand or that are confusing - ask questions