
\chapter*{How to read this book}

This book is structured differently than most books on coding.  While most books on coding aim to teach you coding first---focusing on developing a base of core coding concepts and then shifting to problems---this book aims to get you solving problems as quickly as we can, using that problem solving to teach coding concepts along the way. 

The chapters are built around a narrative structure that follows a student from the start of their coding journey---a hazy awareness that coding may save them time and frustration---to their competence in creating sophisticated tools that they would not have access to otherwise. Each narrative chapter presents a problem (or set of related problems) that might be encountered by someone performing experimental chemical research.  The coding concepts necessary to solve the problem are then introduced via very quick examples along the way. 

Each chapter ends with a fully functional code that demonstrates a complete solution to the problem introduced in the chapter. The design process to arrive at the code is discussed in the text, a flowchart graphically outlining the code is provided, and the working of the code itself is explained line-by-line.

To support this approach to learning coding, we also provide a series of technical chapters that address select coding concepts in more detail or provide important background information that is not strictly necessary to simply solve the problem presented. While not needed to complete the work addressed in the narrative chapters, they are provided for students who desire a deeper understanding of these concepts. The principal goal of the book is to get you to the point that you can solve problems encountered in real-world research and that you have a good enough understanding of Python that more standard online resources are a viable means by which you can further your coding skills. 

Because of the utility-forward approach, coding concepts that are typically taught together are instead introduced only when needed to solve the problem at hand, potentially many chapters apart.  To help parse this structure, each time we introduce a new concept, it is given a subsection.  The heading of this subsection will state what the concept is and what it will be used for. Additionally, at the start of each chapter, we provide a list of concepts that are introduced in each chapter, paired with any concepts we believe are prerequisites for understanding the new concept. While the book is designed to be read in order, starting at Chapter 0, the headings and prerequisites provide an entry point for readers who wish to begin by tackling problems solved in latter chapters.

We are also committed to supporting a community of coding chemists by maintaining a companion website to this book (\website).  This website will house tools to save chemists time that were developed in the course of writing this book, extra content on topics that are evolving too rapidly to fossilize on paper, guidance for setting up your Python installation, and additional exercises to hone your chemistry problem solving acumen. These tools are contained in a Python library called codechembook, and which can be found on PyPi and conda-forge.

Finally, we acknowledge that are many guides and options for installing Python, adding libraries to Python, and coding Python within integrated development environments, all with their relative strengths and weaknesses.  There are also many guides available online for setting up a coding environment for science. Some of these guides will cause you frustration or limit the tools you have to analyze your code and its inevitable bugs.  We \textbf{strongly} encourage you to start out by following our installation guide included on the companion website for this book.  We feel that this guide ensures that you have the smoothest experience learning Python---instead of learning to fix problems with your Python installation. 

\section*{Typographic conventions}
There is a fairly large amount of terminology that needs to be introduced and kept track of. Thus, to some extent learning to program involves learning to `speak' programming, and this can present a significant barrier to those learning programming for the first time.  Our solution to this challenge is to provide a glossary at the end of the book. The first time a bit of terminology is encountered in a subsection, we \textbf{bold} it.  This indicates you can find a corresponding entry in the glossary.  The glossary contains definitions of these terms, as well as the pages were these terms appear in the book---in case you wish to see them used in different contexts. Of course, we also encourage the interested reader to search these terms on the internet, or to ask AI tools about them. 

\section*{For students studying independently}

This book and its companion website contain a number of resources to help you teach yourself problem solving using programming.  We include exercises at the end of each chapter and solutions to the exercises online.  We also encourage you to use the included content as additional instructional materials.

Because you won't have the built-in support structure of a course, when issues arise, you will rely on the wealth of online resources for coding, most of what are not meant for chemists.  Artificial intelligence will also be helpful for overcoming barriers---at the time of writing this book, ChatGPT, Antropic's Claude, Google's Gemini, and Microsoft's Copilot are currently (in the spring of 2024) reasonable options.

% Instructors
\section*{For educators}

The book was written at a level that targets advanced undergraduate and graduate students, though we believe \textit{any} student who has taken a laboratory course that requires analysis and reporting of data will appreciate the material presented. 

The companion website for this book includes resources that can aid in the design and implementation of a course on coding. We provide proposed course syllabi for both 15 week and 10 week semesters and additional problems that could supplement the ones included in the book. We also discuss approaches to homework, projects, and exams---including ideas and examples for each. 

% Advisors
\section*{For advisors and laboratory managers}
We believe that students could gain good coding proficiency in 8 weeks. Specifically, working through Chapters 0-7 (1 per week) will provide a large number of general tools.  The rest of the book is also useful and may help in data analysis. Thus, devoting 8-16 weeks of group meetings could be a way to introduce coding to your research groups.  

\section*{Note on Python version used}

The code examples for this book were largely written using Python version 3.11, and so many of the conventions and usages or Python reflect those required or enabled by that particular version. We note this here, simply to explain differences you may find and you use newer version of Python that allow for different syntax. 
 