2021-04-17

War and Peace - Programming in C#

A plug for my Kindle-published book,
Amazon Link:
"War and Peace C# Programming in Visual Studio"


After more years than can be admitted, keyliner has published a six-volume set of beginning programming tutorials.  2,100 pages, 1,300 illustrations.  

Search for "War and Peace Programming". 

Released on Kindle as a multi-volume set to keep printing costs low and print sizes manageable.  The electronic copy is color, the printed copy is black-and-white.  Fabulous in either medium, but I find the print version faster and easier to use. 


Because it is published on Kindle, it is inexpensive. 

Electronic versions are about $18 each
(roughly 300 to 500 pages per volume)

Printed editions are about $22 to $24.00 (8"x10" pages). 

Kindle takes a big cut, leaving a few dollars for each sale; this is not a money-making adventure.  Plus, they recently raised their fixed prices. Since these are textbooks with illustrations, a large tablet or a Kindle PC viewer is recommended. 


* From Kindle, choose a volume and download a sample, it will show in your Kindle reader.


Series Intro from Volume 1:

These books are different than most publications.

You will not find a "hello world" program. Nor will you find a Console application (at least not until Chapter 24).

Instead, after Chapter 1, you will immediately begin work on loops, if-statements and string-manipulation using honest-to-god Windows programs.  Little time is spent on theories and technical side-trips are rare. 

This means some topics, such as data-type conversions, numeric types, and other such concepts, are glossed over until they are more germane to the concepts being taught.

The goal is to have as much time on the keyboard, working with common business problems.  

After studying this book, and working through the examples, you will be a proficient programmer – able to write real programs that do real work.  Each topic has step-by-step instructions with lots-of code examples, with literally a thousand illustrations.

Illustrations are tightly cropped and annotated.
No full-screen, space-wasting pictures.

Details

Where other books might spend a page or two on a topic, this book dives into the most common and most useful ways to solve a problem.  For example, over 80 pages are dedicated to creating and opening multiple forms, and how to pass data between them.  Both "good ways" and "bad ways" are shown, because you will see these in the real world.


100 pages are spent on parsing, covering delimiters, CSV, Tab, Excel, and other techniques.  This is not over-kill.  This addresses real-world needs and goes beyond a brief description of Microsoft's ".split" command.  Parsing is hard.  I cover the tips and tricks you need to know.

Different techniques for the same problem are shown, and the benefits and drawbacks of each are explained.  If there is a chance of making a mistake in punctuation, style, or logic, you are shown how to identify and solve the problem.  Compiler errors are scattered throughout the book and there is a comprehensive alphabetic error reference in the appendix, with examples, likely causes, and recommended actions.

(Electronic publishing allows the books to be verbose, with details.) 
 

 Why "War and Peace"?  This thing is epic!

My books are different.  My books are better.

The Array chapter is 140 pages long with 80 illustrations (gasp!).  Learn the ins-and-outs about arrays, showing how to apply them to every-day business problems.  This goes beyond the basics of "this is an array and here is how you load it." 

I cover how to sort 2-dimensional arrays! -- something few books attempt, and yet this is a need that many programs have.  As you will learn, sorting 2D arrays is *not* native to the language, but with this chapter you will have the skills to do this. 
 
Most importantly, the Array chapter shows how to solve that perennial array problem, "How big to make the array when the size is not known."  This is solved with a beautiful technique that "over-allocates" the array and auto-grows in a manner that is smart and efficient.  This is much more than a simple "re-dimension" command and works with multi-dimensioned arrays.  This chapter 'rocks.'  

Chapter 26 (SQL data-entry screens) builds a complicated SQL data-entry panel that works exactly as your users want.  This panel properly exposes buttons and menus when needed, prompts users, does field-auditing, and myriad of other things that a well-written program must do. 

Step-by-step procedures are shown.  The skills taught here work in all kinds of programs, not just in database programs.  
 
Are these detailed chapters overkill?  No. 
 
There are a *hundred* other similar discussions. The text is clear, and the illustrations are actually helpful.

By the end of this series, you will be able to write complicated programs that are clean, organized, and can do real work. But all this detail takes time, and takes study.  This is not 'Learn C# in a week.'


Do you just want to try Visual Studio for a test drive?

Order Volume 6 - Instructor Student workbook
$10 Electronic, $13 Print - Cheap and fun



A small, light-weight book, with 5 projects.  Get your feet wet and have fun.  This is a stand-alone book and you do not need the other volumes to do this.

Project 1 is a Star Trek Bridge Computer Simulation.  Frivolous, yes, but loads of fun! 

It will take 2 to 3 hours and it will be mesmerizing. We are talking blinky lights! You can do this.  See it in action here: https://youtu.be/zRtoqZEPVLk



The other projects are more serious -- but most are small enough to complete in a short time.  These include a credit-card program, disk inventory, and an asset-tag manager for computers.

Learn real-world programming

Nothing fancy.  Little theory.  Just practical day-to-day skills that all programmers need.  Skills you need to write real-program -- Programs that parse files, generate reports, and extract data are the goals.

Illustrations are tightly-cropped, never showing a big-wasted full-screen. 
Every illustration has pointed annotations guiding you towards the goal.

Sample Illustration from the ASCII File Read Chapter:


 
Here is a more technical illustration from the CSV Parsing Chapters, showing arrays and array offsets:



A Phenomenal Utilities Library:


One of the benefits of this book is a library of utility modules that you will write, and in the process, learn all kinds of programming techniques. 

These utilities include commands that automate mundane tasks, such as parsing delimited files, punctuating phone numbers, street-addresses, and capitalizing proper names.  This book shows how to package these into re-usable libraries and how to link them into your projects.  These libraries save boat-loads of work and will be useful in all of your programs.


Volumes:

Volume 1:  650 pages
    1    Introduction to the Editor
    2    Introduction to Loops
    3    Conditional Branching
    4    Strings
    5    Numbers and Dates
    6    Utility Functions   *required by all other chapters
    7    Advanced Utility Functions *recommended for all other chapters
    A    Appendix A - Compiler Error Messages

Volume 2: 600 pages
    8    Class Libraries
    9    Variable Scope
    10    Form Controls and Events
    11    Calling Multiple Forms
    12    ASCII Files   
    13    Parsing Tab and CSV Files

Volume 3:  430 pages
    14    INI Files
    15    XML and App.config Files
    16    Windows Registry
    17    Reading Excel, ComboBoxes and SQL
    18    External Programs (Shell)
    19    Wait, Delays, Pauses
    20    Printing
    21    Formatting   
    B    Appendix B - Compiling and distributing code
    E    Appendix E - Building A860_BasicINIRead

Volume 4:  410 pages
    22    Arrays
    23    File Manipulation
    24    Console Applications
    D    Appendix D - Routines of Interest
           Obfuscating and Encrypting

Volume 5:  410 pages
    25    SQL Databases
    26    SQL Record Edits
    27    SQL Data Grids
    28    SQL Data Grid Cell Editing
    29    SQL Data Entry Forms
    C    Appendix C - Installing SQL Server Express

Volume 6:  310 pages  (standalone book)
    Project 1 - Write a Star Trek TOS Bridge Computer simulation
    Project 2 - Convert a photo into Red, Green, Blue and gray-scale
    Project 3 - Write a Visa Card Luhn Check Digit algorithm
    Project 4 - Write a Disk Directory Inventory Program with interesting counts|
    Project 5 - MD5 Checksum viewer for comparing files
    Project 6 - Computer Asset Tag and Network Status

Projects 4, 5, and 6 are programs that are actually useful and I run them on my own computers.  These are downloaded, as compiled programs, from "keyliner.com"


Software Needed for this series

Visual Studio Express
SQL Server Express

These tools are free from Microsoft. Kudos to them for doing this.  Instructions in Chapter 1.

All of the keyliner-developed programs available on this blog (such as the ASCII table program, the raffle PrizeSelect program), Midy5, and EarlKeeper, have been developed using the techniques described in these books.  



Editions:

3rd Edition, republished 2022-01 with new illustrations and text for Visual Studio 2022.  Substantially the same text as the 2020 version, but many small improvements, along with an expanded SQL section.  This should have been version 3.1 but Kindle does not allow decimals and it was not enough of a change to warrant a 4th edition.
 
3rd Edition, published 2020-04; consolidated Version 2's small chapters into Volumes, considerable editing changes.  Republished 2020-10 with a new Volume 6.

2nd Edition: published as individual chapters, 1-26, roughly $3 each.  This was a failed experiment and was too difficult for readers to navigate.  Kindle does not allow these to be deleted once published.



Publishing Humor:
 
When I first submitted these to normal publishers, they were polite, but laughed and said, "We can't print anything this big.  Plus the market is saturated.  We ain't gonna do it."   They were probably right, but I had a great time writing this.  I suspect you'll have a good time reading it.

My thanks to my good friend Steve C. for suggesting the title:  "War and Peace programming"  - much more memorable than "A Beginners guide: Introduction to programming in Visual Studio C-Sharp" -- gasp - what a lame title.


Related Links:Amazon Link:
"War and Peace C# Programming in Visual Studio"

Print Edition Errata

Source Code Downloads
(especially for Chapter 6 and 7 Utility Functions)
https://drive.google.com/drive/folders/1nubCFPLM4c4xUEGdQOimKxqDn8dsQXU1?usp=sharing


 

27 comments:

  1. Hi, the book is excellent and I love the style, my only problem is that your source code links are dead and I'd be extremely grateful if they could be updated as I've just ordered the full set.

    Thanks and excellent work

    ReplyDelete
    Replies
    1. I will look at the links tonight. Odd that they are broken.

      Delete
    2. Sorry, late on reply. The blog gets hundreds of spams a week. hard to weed through.

      Delete
    3. Finally, after more than 2 months, Kindle fixed the publishing problem and the ebooks are now available.
      Thank you.

      Delete
  2. 2020-06 Just re-published all the books. No new content, but fixed transitions, added color highlights, and a few bug-fixes. If you have the electronic version, re-download. And have I mentioned the print version is amazing. Gosh, this has been a fun project.

    ReplyDelete
  3. Anonymous2/09/2022

    Hello. As of today (2/9/2022) Amazon doesn't have Kindle versions of books 1, 2, or 3 available. Please check into that. Thank you!

    ReplyDelete
    Replies
    1. I am aware. Desperately trying to get Amazon/Kindle to fix the problem. I am on my third week with this. Check back soon. Thank you!

      Delete
    2. I would purchase the series but the code links are broken. link gives 404 not found. The book is good but without the links it $%@$$^#$$. I could not recommend War and Peace to my friend for that reason.

      Delete
    3. Code links look good. I de-linked and republished them. Let's see if that helps.

      Delete
  4. Chuck C9/01/2022

    I absolutely LOVE this book and the series! I just posted this review over on amazon for Volume 1 (and the series):
    I am not sure I have ever reviewed anything on Amazon, but I am excited to write this review.

    I have been programming off and on since the early the early 80's... first with BASIC, coding games into a Commodore 64...Next, as part of my job, my boss got me into Delphi which was Object Pascal... Later I learned a bit of C and C++ (Actually coded my own windows that ran as a DOS program all with C and c++) then years later, also part of my job, I was asked to be part of a programming team that coded mainly in C#/.Net.

    So with all of that said, I pretty much had to teach myself how to code and I did so mainly with books... LOTS of books, LOTS of authors. I have enjoyed almost all of the books I bought over the years ...

    But THIS book "War and Peace - C# Programming Volume 1" is fantastic! I bought this book because I have not coded anything for about 10 years and I wanted a refresher. To be honest, I never learned everything that I should of learned to be a real programmer and now that I am re-learning, I wanted to learn it the best I can. I had donated all of my past books to a High School, so I was bookless! lol. This book, as others have said, assumes you have never programmed, but it also can be a book for someone that needs to re-learn C#, or maybe jump from another language.

    What I like is how easy the author teaches this. It is as if he is in the room with you...and every few paragraphs he tosses out a small little joke about this or that...maybe a jab at Microsoft, or a joke about bad coding practice and gives you examples of why this or that is bad, or this or that is good... It keeps you moving and is not boring at all! He balances "here is how it should be done" with a lot of samples, diagrams and then "how it is not done" and how the compiler will bark at you, and hidden gotchas so that you can learn how to code correctly from the start, no matter how simple or complex your program is.

    He does not just teach "Here is how you write this statement, and that is the syntax, write this code, test it, lets move on to the next concept." He goes over it very will with LOTs of examples, pictures, sample code, and heavily commented code.

    Even though I am only at Chapter 3 that talks about conditionals, which I know and a lot of this is review, I am finding that each chapter has something that I never knew, or thought of before. Sometimes he gives you the history of why Visual Studio does this, now and how it used to be handled, or how Microsoft modified C# to be a better version than the last..

    I feel I am rambling but I just cant say enough good about this book.

    I do have 2 small and VERY small complaints.... I own both the print and the Kindle version.

    Complaint 1: In the print version, the pictures and diagrams are not in color and at times seem too small and are hard to read. Also the font is pretty small. However, let's jump over to the Kindle and you get color pictures and other colorful gems like yellow highlights on key text.... and you can zoom in with the Kindle!!!

    Complaint 2, and again a very small complaint is that on the Kindle, it does not support the page turn animation, nor can you change the font. Maybe the author can update this someday?

    Other than that, this IS the book for you.... I hope this review helps you and helps the author!

    I bought all 6 volumes both print and Kindle and one of the best parts of this series is that the books are not expensive compared to other programming books out there.

    ReplyDelete
    Replies
    1. Tim Wolf writing: (War and Peace Programming in C#). I am curious how your studies are going?

      Delete
  5. Chuck C9/01/2022

    I absolutely LOVE this book and the series, I own all 6 volumes both print and Kindle...I just posted this review over on Amazon:

    I am not sure I have ever reviewed anything on Amazon, but I am excited to write this review.

    I have been programming off and on since the early the early 80's... first with BASIC, coding games into a Commodore 64...Next, as part of my job, my boss got me into Delphi which was Object Pascal... Later I learned a bit of C and C++ (Actually coded my own windows that ran as a DOS program all with C and c++) then years later, also part of my job, I was asked to be part of a programming team that coded mainly in C#/.Net.

    So with all of that said, I pretty much had to teach myself how to code and I did so mainly with books... LOTS of books, LOTS of authors. I have enjoyed almost all of the books I bought over the years ...

    But THIS book "War and Peace - C# Programming Volume 1" is fantastic! I bought this book because I have not coded anything for about 10 years and I wanted a refresher. To be honest, I never learned everything that I should of learned to be a real programmer and now that I am re-learning, I wanted to learn it the best I can. I had donated all of my past books to a High School, so I was bookless! lol. This book, as others have said, assumes you have never programmed, but it also can be a book for someone that needs to re-learn C#, or maybe jump from another language.

    What I like is how easy the author teaches this. It is as if he is in the room with you...and every few paragraphs he tosses out a small little joke about this or that...maybe a jab at Microsoft, or a joke about bad coding practice and gives you examples of why this or that is bad, or this or that is good... It keeps you moving and is not boring at all! He balances "here is how it should be done" with a lot of samples, diagrams and then "how it is not done" and how the compiler will bark at you, and hidden gotchas so that you can learn how to code correctly from the start, no matter how simple or complex your program is.

    He does not just teach "Here is how you write this statement, and that is the syntax, write this code, test it, lets move on to the next concept." He goes over it very will with LOTs of examples, pictures, sample code, and heavily commented code.

    Even though I am only at Chapter 3 that talks about conditionals, which I know and a lot of this is review, I am finding that each chapter has something that I never knew, or thought of before. Sometimes he gives you the history of why Visual Studio does this, now and how it used to be handled, or how Microsoft modified C# to be a better version than the last..

    I feel I am rambling but I just cant say enough good about this book.

    I do have 2 small and VERY small complaints.... I own both the print and the Kindle version.

    Complaint 1: In the print version, the pictures and diagrams are not in color and at times seem too small and are hard to read. Also the font is pretty small. However, let's jump over to the Kindle and you get color pictures and other colorful gems like yellow highlights on key text.... and you can zoom in with the Kindle!!!

    Complaint 2, and again a very small complaint is that on the Kindle, it does not support the page turn animation, nor can you change the font. Maybe the author can update this someday?

    Other than that, this IS the book for you.... I hope this review helps you and helps the author!

    I bought all 6 volumes both print and Kindle and one of the best parts of this series is that the books are not expensive compared to other programming books out there.

    ReplyDelete
    Replies
    1. Thank you for the reply! Blush.

      These are "Print Replica" books and I don't think there is a good way to link the page-numbers. I'll look into that idea.

      Illustrations too small: send me a note with an example or two and I'll see if I can find a pattern. I tried to zoom in on screenshots, hoping they would be large enough. (send a near-by word or phrase so I can search. I re-publish the books often, as I find new things to write about. Page numbers shift.)

      Printing in color? I'll see how expensive that is. I wish Kindle would give the eBook version for free if the Printversion was bought. That would be awesome.

      Delete
  6. Anonymous9/09/2022

    Its not the Kindle pics that are sometimes small, just the print version, Kindle is just fine. I am just thrilled with it all!

    ReplyDelete
  7. Chuck C9/09/2022

    I believe I found a small typo in Volume 1 Chapter 4, page 194 in the .Net 6 example... the first MessageBox code reads:
    MessageBox.Show(${strtextA} and {strtextB});

    should it not be:
    MessageBox.Show($"{strtextA} and {strtextB}");
    I kept getting a cs1056 unexpected character '$' took me a bit to figure it out...
    Hope this helps. :D

    ReplyDelete
    Replies
    1. Fixed. Thanks. Won't be visible until next publish.

      Delete
  8. I bought the complete 6 books. I was enjoying the reading, until I realized that volume 5 didn't exist. When I downloaded the book, the only thing I could read was, again, volume 3.
    That is, I paid for volume 5 but I got volume 3

    ReplyDelete
  9. Volume 5. The title is about SQL, but when you look inside and when you download (buy) the book, its content is Volume 3. Please fix it

    ReplyDelete
  10. Luis: You are right! I must have messed up. I just reposted the new version on Kindle. Give it a day to publish, then re-download. Apologies

    ReplyDelete
  11. Dennis6/27/2023

    I am unable to download the corrected version of book 5. I've deleted and re-downloaded several times and still receive book three with picture of the book 5 cover. Please help.

    ReplyDelete
    Replies
    1. Dennis, I am not sure how to proceed. I'll have to contact Kindle. Let me look into this further.

      Delete
    2. I confirmed the right version is uploaded. This has to be a local device cache problem. My expectation was I could update these books when ever I wanted and the Kindle readers could always get the latest edits and changes.

      Is your Kindle reader a tablet or are you using a PC? If a tablet, I'll have to get one to play with.

      Delete
    3. Dennis: I removed my previous comment (which contained my personal email address). Contact me via another mechanism. I want to make this right for you.

      Previous comment said: Dennis. I did an imperfect test. From a kindle device, I "Removed from device" and re-downloaded. It seems to have worked. If not, write to me directly and I will fix this for you. (deleted: PersonalEmail)

      Delete
  12. Anonymous11/17/2023

    Volume 1 chapter 3, There should be mention that “&” in C# is a bit wise operator while “&&” is a logical operator .
    The Bitwise version is used by us dealing with hardware flag checking quite often .

    ReplyDelete
    Replies
    1. The bitwise comment is being added for the next edition. It took me a while to understand your comment. (I am thinking Vol1 needs more "fun" things to do in the early chapters. It is not until Vol2 that you get to read an ASCII file -- and I always find that fun.)

      Thank you.

      Delete

Comments are moderated and published upon review. (As an aside, not a single spam has been allowed through; why bother?)