I am excited to announce that my book, Write Your First Program is finally available for public consumption. In this day and age, when there are easily accessible programming books galore (in the context of both, price and availability), why write a new book? Through this post, I hope to reach out to the prospective readers and buyers (and hence critics) of this book.
I will start with a summary of the contents of the book, and then make an attempt to analyze a few key things I chose to be a part of this book and how I think those choices should help anyone attempting to get a first taste of programming today.
Summary of the book
The book stands at 242 pages (in paperback). It has seven major chapters starting from a Hello World program, followed by the concepts of variables, input/output, user-defined functions, data structures, file handling, mathematical functions and advanced concepts (object oriented programming, error handling and version control) . Each chapter discusses and implements each of those concepts in two programming languages: C and Python. Most of the chapters have a programming fun section where I use the concepts introduced in that chapter (and others before that) to write a program which the readers can enjoy implementing. There are exercise problems at the end of each chapter which aims to encourage the reader to try out writing new programs.
Analysis of the Choices
C & Python: Besides the contents, which I will come to soon, the major decision I made while starting with the book is that it will aim to teach not one, but two programming languages – C and Python. The choice was far from being arbitrary or a way to be different from most programming books. It reflects my own (however flawed that may turn out to be!) assessment of what the beginning programmer today should learn.
I was exposed to C few years after I learned to program and it’s power became clear to me as I explored writing MS-DOS TSRs and later, Linux Kernel modules. Somewhere in college, in the early 2000’s, I got a book on Python. As I have programmed increasingly in Python and learned of the multitude of ways it’s been used in all sorts of projects – Linux utilities, Scientific and Numerical computing and Web application programming, my quest to learn more about Python increased and with that my urge to talk and write about how awesome Python is. For me C was raw power, where as Python was elegant and beautiful – good to read, write in and get the job done fast.
And hence, when finally the moment arrived I decided that I would attempt to teach both C and Python in my first book. I have this urge in me to always get out all I know and share with someone (not verbally, I am not much of a talker) via my writings.
How would I go about teaching two different programming languages in one book without intimidating the audience of the book?
Contents: I decided that I would include topics which covers the bare minimum that the beginning programmer should know from the perspective of programming. I start the book introducing concepts such as variables, data types, input and output, control structures and user-defined functions, showing how to implement the ideas and concepts as programs in both the languages. I introduced C’s scary pointers in Chapter 2, along with the discussion on variables and data types. It just seemed natural to me that addresses of variables should be discussed with variables. I also introduce recursion in the chapter on user defined functions. Towards the end, I cover the topics of encoding, error handling, and working with multiple files. Considering the importance of using version control for projects, I also discuss the preliminaries of the git version control system and briefly touch upon the idea of text encoding in one of the appendices. Overall, I aimed to keep the topics naturally coherent not assuming a topic or concept may be difficult for the beginning programmer and hence introduce it later. The reader should ideally skip such a topic and come back to later.
Within each topic, I tried to keep the treatment to “just enough”, but not superficial. The reader will be able to learn enough to write useful programs (as part of an academic course, hobby project) and more importantly, be able to approach more advanced areas of either programming language with confidence. I also refrained from discussing quirks of programming language constructs (such as for(;;) in C) , which I believe can be lived without. There are books out there aiming to equip a reader with such knowledge and honestly, even if I wanted to, I don’t have the skills to do that. My book doesn’t aim to be a reference text. It aims to get you started, true to its title – help you write your first program.
Throughout the book, I have attempted to discuss programming in the context of other “subjects” of study – by asking the reader to attempt writing programming solutions to problems from those fields. This will hopefully also interest the reader who may not aim to take up computer science or programming as a career, but may need to use it as a tool.
Well, that pretty much sums it up. If you think this book may be worth a read, the buying options are as follows.
Buying the book
Print copy: Print copies are limited to India only (at least as of now). You can buy it online using any of the options below:
- Amazon Kindle (Even if you don’t have a Kindle, you can read it using Amazon’s Kindle applications. In fact, the book’s source code doesn’t look so good on the “old” Kindle, so, I recommend the kindle applications strongly)
- Adobe Digital Editions
The book’s website is at http://phindia.com/saha and it will contain additional articles/materials and other content that the book’s readers may find useful. And of course, a list of errata (already found two myself) :-). Thanks for reading this post. I would be keen to hear from you in case you happen to buy my book or have something related to say/discuss.
This book was quite a journey on the personal front as well. You may enjoy reading it here.