I’m going to publish another series of videos from Learn Code Live where I refactor one of the student’s code. This code is exactly what he was expected to do when going through Learn Python The Hard Way, so really nothing wrong with it. But, I took his code and pushed it as far as I could toward “professional”. This series is 4 videos and you can watch the first one here:
One aspect of learning to code for a beginner is learning how to “speak” like a “real programmer”. Normally they pick this up by either working at a job where people correct their code, or hanging out with other programmers online. Many students though don’t have the time or luxury of those situations, so I do that for them live. I find a volunteer, and I improve their code over the course of 2-4 sessions taking it as far as I can go. I treat the sessions in much the same way I would if I was teaching a junior developer on the job, so you can watch this and get some idea of what that might be like.
If you are a beginner and you have some code you’d like to volunteer to refactor school then message me on the forum and we’ll talk about it. I’m looking for volunteers and I’ll give you the videos with my refactoring in exchange for you letting me review and repair your code. The process is not abusive or overly critical, and it’ll help you see how I might write your code.
If you do have code, make sure that it at least works first, and that I can get it somehow. It should also be relatively small, so maybe 3-10 files of Python code. Other than that, let’s talk and work something out.
I’m going to start publishing free content for people to consume in areas that I find help people in general but don’t really fit into any of my own products. In this post I’m going to talk about OOP School, which was a 5 part series featured in LCTHW:Live. In this series of lessons I actually build a basic working OOP using only dicts and modules in 64 lines of Python code.
Probably the best video to watch and understand what is done in the 5 video series is Seminar #5, where I go back through the code and explain what I did:
The purpose of these lessons is to remove the magic behind Object Oriented Programming. Too often beginners see code like this:
and then shut down because they can’t follow what is going on. To me I know what the . (dot) does in every language I use, but that’s only because I grew up actually implementing the dot in a few languages that didn’t have OOP. I did this in C, Pascal, and I think I tried in BASIC but gave up. I forget, it was a long time ago because I’m old now.
This Learn Code Live seminar series starts with a person who knows the following:
And using just that (plus some small jumps into other corners of Python), builds an OOP system that gives you the basics of Python’s OOP in 5 hours of work and 64 lines of code.
Objects Are Not Magic
I believe that programming languages like Python have a vested interest in making parts of their programming language mysterious and magic. What languages like Python do is hide mountains of operational code behind a single character: the dot. This seemingly tiny character unleashes potentially hundreds of thousands of lines of code inside Python without you being able to understand it.
In fact, the early creators of Python didn’t even understand it and had to rewrite the Object system at least 3 times. Many Python practitioners today think that there’s a huge difference between objects, classes, dicts, and modules. The only real difference between them is one of syntax and first class language support. You can completely implement objects and classes using just dicts and modules, and even inside every object and class hides a __dict__ which means they really are just dicts.
Object Oriented Programming is not magic. It’s not some truth of the universe or mystical thing only ordained Real Programmers understand. OOP is code that someone wrote which gives you three things:
Syntax – You don’t have to type out a function name like get(), new(), set(), inherits() to work with objects and classes. You just use . (dot), parenthesis, equals, and other symbols and Python does the rest for you.
Conventions – You don’t have to remember to call certain functions in the right order to talk to another person’s code. Because Python gives you syntax it forces everyone to follow the same conventions so their objects work together.
Parsimony — You don’t have to manually write out which classes inherit from other classes or explicitly name every method that has to change in a subclass. Python saves you from having to repeatedly type out boilerplate because it has syntax and conventions to do all the for you, and to make everyone else do it too.
All of these things are just social constructs, they are not core truths of a computer. They are not so huge an advantage that you can’t sit down and build your own replica of these concepts and come up with your own OOP system. As long as you have some kind of function and some kind of dict you can make an object system. I mean, how do you think Python has an OOP system? Magic elves built it?
When it comes down to it, an Object Oriented Programming system just an application of data and functions to enforce a convention through syntax that allows multiple humans to share code in a parsimonious way. You can build your own and any language or programmer who tries to tell you that you can’t build an OOP system from first principles that replicates the one they use probably has no idea how theirs works.
You know, like the people who invented Python.
The Full Series
By watching this series of videos you can get at least a tiny idea of what is going on behind the dot and understand the basic concepts of OOP before trying to actually learn it. It’s only 64 lines of code (available here) that is simple enough for a beginner to understand, and not full of extraneous features not many people use like multiple inheritance.
This is an example of the kind of hacking and teaching I do on Learn Code Live. If you’d like to join my new Learn Code Live and get in on the Python Basics Workshop I’m going to run then you can Signup Here and you can see a searchable list of everything already recorded that you get after you signup. The next class is going to be this Saturday at 12pm EST. Hope to see you there.
I’ve planned to run a Python Basics Workshop for about a month now, and wanted to do it on August 13th but it turns out to be way too early for most of the people in my Learn Code Live class. It is also too early for me as I want to add a few more features to the LCLive product before then.
The PBW is a firehose of Python for one week starting on September 3rd. The goal is to get you through my entire Learn Python The Hard Way book at a fast pace but with my guidance helping you. You’ll then be able to start the book over and get through it in more depth faster. You can watch this starter video to find out more about how we’ll run it and what you’ll be doing.
What’s In The PBW Product?
Originally I intended to have people join my Learn Code Live product to get the Python Basics Workshop, but a lot of folks don’t want the 30 days of live coding just to learn Python.
So, you can signup for only the PBW for $29.99 and you’ll get the one week crash course only. You’ll attend the PBW live and get to keep the recorded videos after, and help on the forum with everyone else.
If you sign up for Learn Code Live for $99.99 then you get the Python Basics Workshop included in your 30 days subscription, which includes 50+ hours of past videos I’ve recorded and a lot of other goodies like premium help on the forum, more live seminars every week, and new features I’m planning soon.
Feel free to email me at firstname.lastname@example.org if you have questions.
Are There Sample Videos?
Yes, you can watch tv.learncodethehardway.com to get an idea of the kinds of topics and style of teaching in the Learn Code Live or Python Basics Workshop. The workshop will be much more directed and controlled, and the LCLive topics get tailored to what people are struggling with in general.
I’ve been working on how to do live online training for close to a year now. After many random problems, missteps, and changes to how it works I think I’ve finally figured out how to teach people online without eating up too much of everyone’s time and resources. I’ve been doing this latest format called Learn Code Live (or just LCLive) for about 4 months and it’s working really well. Today I’m opening it up to everyone, and this blog post will explain what it is and how to join.
I have no idea why people put the TLDR at the end, so here it is. If you’re a junior developer who wants help, someone who’s looking to get into python, or you’re interested in next week’s Python Basics Workshop, then you can sign up for 30 days of Learn Code Live here for $99. The billing system is not recurring, so don’t worry about being charged $99 every month without your permission. Instead, you get a reminder email at 7 days, 3 days, and 1 day before your 30 days are up. If you renew then you get another 30 added on. If you don’t then you’re done and I’m totally alright with that. Learn Code Live is intended to be something you join and leave as you need.
I originally wanted to do a whole school that was online, but I found that online interactive education is simply too time consuming for most people. Overall I found the problems to be:
Streaming live content is a royal pain and full of all kinds of technical issues (which I’ll talk about in another blog post).
Most people just don’t have the time to complete work on a rigid class schedule. When they miss one seminar they just give up and don’t bother continuing.
Interactive chat is terrible for education. People ask terrible questions, are always in a panic, treat the chat like their personal therapist, do more socializing than working on code, and eat up too much time from everyone.
If everyone is expected to follow a course schedule they start to compete with other students and give up if they fall behind or can’t do as well.
Everyone has different goals in learning to code and many times just need help with small problems they encounter in their own work.
There were other little things I had to change, but in general these were the biggest wins when it came to improving the experience of online students who are busy. I should make it clear that I’m talking only about people who have limited time to learn to code. These things may work for people who are in an actual class setting.
How I Fixed It
When it comes to teaching busy people online I simply found that chat and a rigid class schedule did not work at all. What I did to fix it is:
Got better at live streaming. I managed to sort out a ton of technical issues around streaming my own videos. Everything from dedicated audio hardware, to how to edit the videos quicker, to how to stream it to a CDN with reduced costs. I even managed to write my own little (and right now terrible) live chat for during the video, and have videos showing how I wrote the little chat too.
Got rid of the chat. We were using Discord for a while and I found that the quality of questions and my ability to answer were just substandard. It seems like, if you have access to chat, then you don’t really think about your question much and you don’t try to solve it on your own first. With chat you’ll just run screaming in a panic at the first error and dump tiny one-line questions, forcing everyone to eventually tease out what would have been a single forum post. The chat also required 24/7 monitoring and if I missed someone they would usually just drop off rather than ask again.
Switched to a forum for announcements and getting help. Programmers use IRC a lot, but if I’m being honest I think the quality of assistance on IRC is absolutely terrible, and I should have realized that would be the same on Discord or any chat. Switching to the forum solved all the problems we had with chat. The quality of questions went up, the quality of answers went up, people don’t have missed messaged anymore, and nobody wastes time socializing when they should be coding. I now believe that highly interactive chat influences students to not attempt to think through their own problems and to rely on other people to do the thinking for them. I also think that trying to give answers to people on chat was way too difficult. The forum simply solves all of these problems.
Changed to curriculum checks instead of a defined curriculum. In the past I’d lay out a curriculum for people to follow and then do the live presentations to match it. And everyone would be pumped for a week, not listen to anything I told them about slowing down and going at their own pace, and when they fell behind they’d just give up. It seemed a defined schedule just hit all the fear of failure buttons and prevented people from going at their own pace. Now what I do is at the beginning of a month I put up a Curriculum Check post and find out where people are and what they need. I then tailor the next series of videos and topics to hit what most everyone is working on or needs help with.
Gitlab but less code review. We had a gitlab that I was using to do code review, but the tools in gitlab for reviewing code are terrible. Gitlab is great, but without a way to organize my review queue it was simply too hard to do it efficiently. I found this also made people afraid to ask for help with their code because it has this big label of “CODE REVIEW BY ZED”. Now I give people access to our lab so they can practice storing things in git and using it, and then they can ask me on the forum to look at projects they’re having a problem with.
Implemented Refactor School instead of code review. I still think students need to learn how to write their code the way someone like me would, so now I do something called Refactor School. I ask for a volunteer who gives me their code, and then I go through it live and refactor it to be what I’d expect. This is similar to sitting with a Junior developer and refactoring their code so they know how to write it. We found that this is a much better way to get feedback on how code should be written and helps them learn some great tricks that I might not have realized they don’t know.
No set schedule or expectations at all. I mentioned this before but having a schedule or a list of expected tasks simply kills people’s motivations, especially if they’re perfectionists or have a fear of failure. I found that when there was any kind of deadline I would have people trying to finish things off last minute in a massive panic and making all kinds of simple mistakes. They’d also get behind and then beat themselves up over it rather than just keep grinding through it at a slower pace. Finally, they also simply didn’t take the time necessary to learn the materials and study since they were always in a rush. Now, there’s no expectation at all and everyone works at their own pace. We use the curriculum check and we also do a weekly accountability thread.
Accountability threads. The only goal in LCLive is keep working. Even if you only did 1 exercise during the week, just keep working. To enable this we have an accountability thread once a week where people basically do a standup and explain what they’ve done, what they need to do, and blockers keeping them from moving forward. This is much better than tracking their work and having a schedule as it allows for people with different lives.
Many products are developed for the Live students first so you don’t have to buy them. VimSchool is one example where students in Live watched for free and can download it. You can also check out my free TV site at tv.learncodethehardway.com to see other examples of what you get.
About 2-4 live seminars a week on requested topics from students. You can watch them live and chat with others, or download them after.
You get the Python Basics Workshop I’m announcing tomorrow. This will be a 1 week workshop to get people started in Python or refresh their Python skills. Even if you can’t attend you can download it later, and then you have 30 days for the subscription so you can get help while you review it.
An account on a private gitlab server to learn how to use git, get help on complex topics, and get access to special LCLive projects I publish.
Advice and help on most any programming topics, not just my books.
What’s Coming Soon?
I’m going to be doing more workshops, a lot more Zed Codes, and focusing on specific trouble spots that I find people have. I’ll also be adding an option to add all of my books to your subscription for an additional cost. I used to include them but it became very confusing to manage so I dropped the price and then removed that option. Other than that I think this mix of features is the best I can do for online training.
You just have to go to the Learn Code Live Buy Page and purchase it like any of my other books. You’ll receive a special email saying that you bought it and that I have to setup your forum and lab access. After that you can go to the /live/ section of the site to attend the next seminar, and visit the private section of the forum.
What’s Python Basics Workshop?
This will be announced tomorrow, but I’m going to spend next week (August 13-17) doing a special crash course for people who want to get into Python 3. The goal is to get people who are just starting out a way to slam through a “detailed overview” of the book’s contents, with the idea that you’d then go back and spend more time on the exercises. The PBW would also work for people who want to get back into Python and just want a fast way to learn it.
It’s not expected that you’d be a master Python programmer at the end of the week. It’s more that you’d know what’s involved and then can have a realistic expectation of how to do the book from the beginning again. It also works as a way to make you do the work for one week. Here’s how it would work:
We meet live every morning at 10am EST, Mon-Fri, and go over the exercises for the day. I’m planning on 5-10 each day depending on how everyone is doing.
After each seminar I hang out in the chat and help people get through the first part of the exercises and get through and road blocks.
You then go off and do the exercises yourself, and if you miss the seminar then you can just watch the recorded one and then do your work.
At the end of the day at 3pm EST we hop on chat (and maybe video) to check up on where everyone is at and to answer any questions.
During the day, as you work, you can ask for help on the forum and I’ll be monitoring it so the response will be fast.
TLDR: I’m running a low-fi to the point Vim course once a week for 10 weeks and a spot in the forum for help. You’ll get 10+ hours of video and my configurations and notes. You can buy it at http://bit.ly/GetVimSchooled and the first Seminar is up.
I’ve had many people ask me how I use Vim, but I couldn’t really figure out how to write a book to teach Vim. I realized a while back that the majority of the things people need to learn about Vim are best demonstrated in an interactive way. I can blast you a book with all the commands and tell you that 10cw will delete 10 words but, until you actually see someone who’s good at Vim do that it doesn’t seem to click.
The other thing I’ve realized is that everyone tells people how to use Vim, and then proceeds to do it in a totally different way. It’s just too hard to keep track of all the ways I might use Vim, little tricks, settings, how I use power macros, and other things unless I’m really editing and then showing you how to do it.
So, last week I threatened everyone on Twitter that I’d create a series of videos I’m calling Vim School and this week I did exactly that. I’m recording these in a Live Seminar format with a core group of students who are beta testing my Learn Code Live project. That means there’s people asking me to repeat things while I’m demonstrating Vim concepts so they keep me honest and make sure I don’t gloss over things.
If you want to get in on this, then you can buy it at http://bit.ly/GetVimSchooled and you’ll get 1 seminar per week after my LCLive students have seen it. The first seminar is up and it’s 1h 11m long with a crash course jump into Vim. You’ll get an announcement on the https://forum.learncodethehardway.com/c/vim-school part of the forum, and you can get clarifications and help.
Vim School is like Vim itself: Low-fi, brutalist, no frills, to the point, and effective. There’s no fancy graphics, diagrams, pretty buttons, or anything but Zed showing you Vim in all its blazing fast Text Mode Katana glory. I’m doing these videos in 1080p, but honestly I could do them in 480p and they’d still work.
Starts off assuming you know nothing, then slowly goes through each concept needed to use vim until you have a fully configured vim for programming work.
It’ll cover everything from your basic motion and editing commands to more advanced automation, code searching, and configuration for real work.
It’ll be based on how I use Vim, which is a much simpler and more reasonable way to use it for a beginner.
You won’t be required to use hjkl to move around. You’ll just use arrow keys, but more importantly, you’ll learn that the entire point of Vim is to not do tiny moves anyway.
All the videos will dynamic keystroke display so you can see exactly what I type.
There will be session notes posted shortly after the seminar is posted.
I do everything inside Vim. I write up the sessions notes live, edit code, run it in a terminal, every single thing I can I do from Vim. This helps you see if I’m using and secret tricks you haven’t heard of that you want to learn.
I’ll provide you with my configurations each week so you can build up your own configuration by learning what each thing does. This first seminar I did a quick run through and put up a minimalist config for everyone to use.
Price is $19.99 for all of the videos, and you’ll get 1 per week assuming I don’t have anything pressing that week stopping me. If I’m ever late a week you’ll get double the next week.
Wait, What’s LCLive?
I’ve been running live training for beginning programmers for the last 6 months in a private beta. I’ve had to really change how it runs several times to simplify it and to figure out this whole online streaming thing. Let me tell you, online streaming of a screen is much harder than it seems if you want to do it with any kind of quality.
The original incarnation of LCLive was the Junior Developer Certification Program but that was way too complex and involved for people to do successfully. I’ve since stripped that concept down to just something that provides people who are learning to code with extra help from me in the form of:
A private section of the forum where you get priority assistance with your code.
Help with nearly anything related to becoming a programmer or working your first job.
One main video a week where I cover some topic in a series. We’re currently in the Debugging and Refactoring series. I’m taking volunteer’s code and we’re all debugging it or I’m refactoring it to show how I’d do it. We’ll probably do this for a while since it seems to really help people.
Special bonus videos such as this Vim School. That means yes, if you sign up for LCLive you just get Vim School included with your LCLive subscription.
Access to all of the past LCLive videos, which is about 30 hours of content right now.
I’ve almost got the format nailed down, so I’ve been keeping it quiet and among my tiny group of friendly students who want the extra help. I’m not quite ready to release it fully, but if you want to sign up then it’s $99.99 per month and you have to email me at email@example.com asking to join LCLive. You’ll have to understand that there’s going to be tech issues at times because it’s a beta product, but it seems to be going well as of this week.
What About Emacs School?
I could potentially do a similar Emacs course but I honestly really suck at Emacs as it’s not my main editor at all. If you’re an Emacs grand master and interested in doing a similar course feel free to comment and let me know.
When I started Learn Code The Hard Way about eight years ago, I made a conscious choice to run my business ethically. I decided to never collect information unless I really needed it, to not track people as they went through my site, and to not sell anyone’s information to someone else. I felt this was the right move because education is a sensitive topic, and I didn’t really think it was appropriate for me to sell people’s behavior on an educational resource. I also would rather make my money by building good products rather than selling my customers like they are products.
For the last eight years I have only stored enough information to let you get back to your purchase. For example, I do not remember where you are in the book because if I store that information then I am tracking everything you’ve read, and that kind of violates your privacy. Some people have asked me to implement a feature for keeping track of what you have read, but I feel that that’s too risky of the feature to implement. I also didn’t include any passwords in my system. I simplified it down to the bare minimum necessary for you to access the content from your email. In fact, I store people’s names but I don’t even it enforce that they give me a real name.
I do collect people’s IP addresses, but that happened after almost a year of constant fraud and a barrage of continuous SSH attacks. I have to keep the IP address information for fraud prevention and security purposes, but I only keep your most recent IP address on your account and it gets wiped whenever your IP address changes. I also only keep logs for about a year, mostly because I’m too lazy to reconfigure the log rotation to do it faster.
I am also a very hated individual on the Internet. Because of this I have had to make sure that I have the best security I can get, but I also assume that no security is totally foolproof so I do my best to keep data off my service that I don’t really need. The data I do have is either minimal or I encrypt it with GPG and my private keys never touch the servers. Obviously none of this is totally secure in the face of a very determined attacker, but because I don’t really store much information about people and a lot of it is encrypted, the potential damage is very low.
Finally, I gladly delete people’s accounts if they email me, but I warn them that once they delete it all then our relationship is over and they would have to buy the product again to download it again. That seems reasonable to me because you can’t say, “Hey, forget everything about me,” and then come back a month later and say “Hey do you remember me?” No, because you told me to delete you.
I believe the only things I do is I have Google analytics on my site, and a Zendesk help chat system that nobody uses. I’ll just remove the Zendesk chat, and if you want Google to forget about you then contact them. You can still email me at firstname.lastname@example.org when you need help or you can use the forum at https://forum.learncodethehardway.org/ but that little chat thing is totally useless.
I actually believe that without a treaty between the United States and the EU, that the EU would be violating international laws by enforcing the GDPR. But, complying with it doesn’t seem to be too difficult for my business, and if I comply with it I can go to Europe in the future and study art at Louvre.
I’m not kidding. I really want to copy paintings at the Louvre. I can’t do that if I owe 20 million euros to France!
With that in mind I am going to be slowly rolling out some features to make my business compliant with the GDPR and it will be for everyone around the world:
You will have a delete button for your account, but you will need access to your email to prove that you actually are who you say you are, and once you delete you have to buy the product again to get it back. As I said it’s not fair for you to want to maintain a data relationship with me but then also delete your data.
You’ll be able to get a a JSON dump of the data I have on you. You are probably going to laugh because it’s literally like two database rows.
I will follow the GDPR mandate to clear web traffic logs after three months, but I will keep all security related logs for two years because now the EU has declared IP addresses identifying information so I can start submitting your IP address from hack attempts against services to law enforcement in the EU.
I will keep your purchase information and my payment processor because my country’s tax system demands that I keep that information for at least seven years and maybe longer.
I will be the data officer, until I can afford enough money to hire someone official in the EU, or I have a real reason to do it.
Hopefully that’s enough to show a good faith attempt to follow the law, and my track record of basically already complying with the law should be good enough to avoid the €20 million fine that they are going to give me. I’ve been told by several Europeans that as long as I’m following the law as best I can that, “Totally nobody’s ever going to go after. The EU is a nice guy eh? Buddy pal you can trust us? <big grin>.” We shall see.
I like the spirit of the law, and it matches what I do already, but I will be honest and say I worry it will be abused by bigger corporations to stifle speech and stop bad press. I also feel the GDPR will mean nothing to large corporations and that the EU government will only enforce it on small companies that can’t defend themselves. Time will tell, but in the mean time, I’m going to keep my European customers happy and bring this out to everyone at the same time.
I found that beginners develop an unrealistic idea of how programmers actually is done because they see me using a different set up than I actually use when I code. When I code I don’t use a screen that’s 1080 pixels tall. I actually use a screen that is much larger than that and sometimes even used two screens.
The Planned Features
UHD quality video at 2160P resolution, but with smaller files for people with limited download Internet.
A combined format that starts from a beginner level and goes all the way to completing many projects of increasing degrees of difficulty, effectively being two books.
As with all my books HTML and PDF formats will be available.
A total of 62 exercises.
This weekend I will be publishing the first exercises that I’ve written which will be up to exercise 6. This first release will be a draft, and should include most of the videos for those exercises. I will then be able to post probably three or six videos a week depending on the difficulty of the exercises. The first half of the book is just basics so that’s pretty straightforward, but the second half of the book is actual coding on small projects so those are little more difficult.
Finally, as I said before the price on the book now is $20 and that’s 50% of the final price of the book is done. Because this book is basically two books, and it’s going to use 2160p video the final price for the book is going to be $45 instead of $40. That means you original purchase of $20 is now even more of a discount once the book is released.
Current Table of Contents
Part I: Basics
Section 1: The Beginning
Exercise 00: Gearing Up
Exercise 01: A First Program
Exercise 02: Comments
Exercise 03: Simple Math and Strings
Exercise 04: Variables
Exercise 06: Escape Sequences
Exercise 07: Prompting Input
Exercise 08: Command Line Arguments
Exercise 09: Files
Exercise 10: Files, Args, Variables, Oh My
Exercise 11: Functions
Exercise 12: Functions, Files, Variables
Exercise 13: Modules
You can see that this book goes a little faster than my other beginner books and has a lot less repetition. By Exercise 13 we’re already loading in external code, writing functions, opening files, and other simple tasks. In my previous books students didn’t reach this level until Exercise 25.
Section 2: Logic and Flow Control
Exercise 14: If
Exercise 15: If and Else
Exercise 16: While Loops
Exercise 17: Lists and For Loops
Exercise 18: More Lists
Exercise 19: Data Objects
Exercise 20: First Game
We then get into Logic and Flow Control, where you learn how to make the first useful bits of actual computation.
Section 3: OOP
Exercise 21: Simple OOP
Exercise 22: More Complex OOP
Exercise 23: Prototype Inheritance
Exercise 24: OOP Game
I then introduce OOP, but it’ll be just enough OOP to be dangerous, in keeping with the theme of Part I.
Section 4: FP
Exercise 25: Functions and Recursion
Exercise 26: Transforming Data
Exercise 27: Applying Functions
Exercise 28: Scope and Closures
Exercise 29: Currying and Accumulators
Exercise 30: Events and Callbacks
Part II: Projects
Section 5: Hacks
Exercise 31: Parsing Command Line Arguments
Exercise 32: cat
Exercise 33: find
Exercise 34: grep
Exercise 35: cut
Exercise 36: sed
Exercise 37: sort
Exercise 38: uniq
Section 6: Data Structures
Exercise 39: Single Linked Lists
Exercise 40: Double Linked Lists
Exercise 41: Queue and Stack
Exercise 42: Sorting Algorithms
Exercise 43: Hashmap
Exercise 44: Binary Search Tree
Exercise 45: Binary Search
We then implement some very simply and naive versions of the classic data structures, and start to focus on quality and testing.
Section 7: Testing and Hacks
Exercise 46: xargs
Exercise 47: hexdump
Exercise 48: tr
Exercise 49: sh
Exercise 50: diff and patch
The student then combines testing and quality with quick hacks to apply their knowledge so far.
Section 8: Parsing
Exercise 51: Finite Sate Machines
Exercise 52: Regular Expressions
Exercise 53: Scanners
Exercise 54: Parsers
Exercise 55: Analyzers
Exercise 56: Puny Python
Exercise 57: Calculator
Exercise 58: BASIC
Section 8 will get into the very basics of parsing programming languages.
Section I: Final Projects
Exercise 59: blog
Exercise 60: bc
Exercise 61: ed
Exercise 62: sed
Finally, they finish off with a set of open ended projects that are meant to combine everything they’ve learned so far.
Hello, it’s been a while since I’ve written something here as I’ve been busy writing other things. Today I would like to ask for help from people who might be struggling with learning because of an oddly specific problem. I have found that people who consider themselves “perfectionists” seem to have trouble learning because of how they view the creative process. The problem is, I am pretty much the opposite of a perfectionist, so I have no idea what it’s like to feel this way. I’d like your help understanding your experience with failure as a perfectionist.
As far as I can tell people who view themselves as perfectionists seem to give up very quickly. At the first sign of any errors or mistakes they have an incredibly negative reaction and either give up or get angry. I’m not exactly sure why but I believe it’s because they feel that the way you create something of high quality is to never make an error. But, this is completely different from how I actually make almost anything. For me creating something is kind of like a tight rope walk balancing on the edge of disaster. If I make a mistake I just assume that I have fallen off the rope and need to try again, or I have to correct and continue.
In an effort to understand how some of my students see the creative process I’ve started looking at how they tend to fail. Or, more accurately how they seem to react negatively to small failures. I actually don’t think that you can really fail in programming or other creative activities, because you simply just keep doing them until you get better at dealing with potential disasters.
But I see many beginning programmers have what I call the “epic failure meltdown” at the first sign of any mistakes. I would like to find out how this feels and any insights as to why this might be happening.
After some research on this I believe that part of the problem is a misunderstanding by perfectionists regarding how something is created. They simply don’t understand the creative process. But I would love for people to reply in the comments on this blog post, and tell me how does it feel, as a perfectionist, to make a mistake. It’d also be helpful if you can explain why you think you are a perfectionist and whether that helps you make anything perfect.
I’d also really appreciate it if you have any insights as to how someone else might get past this negative reaction to failure. If you have coping strategies or a way of viewing things that have helped you then please let me know.
The end result of this research will be a blog post and a few videos aimed at people who misunderstand the creative process and take “failure” the wrong way. This won’t be specifically aimed at programming but just generally at people who create things and give up too early.
Finally, if you aren’t comfortable posting here publicly, you can email me your experiences at email@example.com and I’ll keep what you say private.
Here’s a few questions from people regarding the shell that are just simple misconceptions about what it does or questions about small little concepts.
Finder Tracking Bash
My question is in regards to the Appendix Exercises. So I am operating on a MacBook Air, and for my Terminal, I am typing out my commands. I also have open my directories folder so when I am doing commands, I can see the effect of it. What confuses me is the cd ~ command. Let’s say I click on my documents and it takes me to a subfolder. I then go back to the Terminal application and when I type in cd ~ it doesn’t take me back to the home page. Does the cd ~ only operate theoretically?
The ~ is an alias for “wherever my home directory is”. Your terminal does this because your home could be in different places on different Operating Systems (OS). Try this:
On a macOS computer, you’ll probably see something like:
Now if you’re on a Linux computer it’d be:
And on PowerShell it’d be even more different depending on the Windows version you use.
Also, I think maybe you expect that cd ~ in your Terminal would also change your Finder window? There isn’t that much of a connection between the two (although that’d be kind of awesome). It’s more that, when you make changes in a directory, they’ll show up in Finder. Doing a cd to a directory doesn’t change it though, so you don’t see that happen in finder as well.
BEEP BEEP BEEP
I just wanted to tell you how much I appreciate your teaching method. It suits me perfectly.
I had purchased 2 books before yours and tried several online videos and websites Yours was the first time and place I felt I was actually leaning things from the ‘ground up’, Especially helpful was your Powershell crash course. Just beautiful.
I’m on Exercise 11 and just about to watch your video. But I wanted to tell you about trying escape sequence \a. At least on my computer, it makes a cascading chime sound when I insert it into a string and execute in Powershell. You probably already knew that. You’re so smart.
Thanks again for all the thinking you’ve obviously done on how to best teach programming.
Ahhhh, that’s called the “bell”. I guess in PowerShell it’s way more awesome than on Unix because with Unix it’s just an irritating “BEEP”. I sometimes use that to tell me when a long running script has finished on a remote server. I just have the script print out a large number of \a beeps at the end, and then when I hear the classic unix BEEP I know it’s done.
But, on my macOS machine I had to re-enable it to make the bell work. I probably disabled it because the beep is annoying and the bash shell we all use loves to beep at you for everything. Completing a file? BONK BONK BONK! Backspace one character too far? BONK BONK BONK. To turn it on (or off, if you hate that like I do), you go to Preferences in Terminal, go to Advanced panel, and click “Audible bell” like I have here:
Anyway, you’re welcome. I’m glad you’re getting along with it well and enjoying it. Now I’m going to go and turn off this bell so I don’t go insane.
\v \f Weirdness
This question comes from the Gitter chat so I cleaned it up into a paragraph format:
Hi all, anybody having different outputs when using escape sequences from exercise 10?
Trying to use linefeed “\f”.
I’m using ASC11 linefeed (LF) and I’m getting a female symbol instead of a return indentation.
Here’s the code I’m running:
asc11_formfeed = “Using ASC11 formfeed (FF) \f escape”
And the output is:
Using ASC11 formfeed (FF) ♀ escape
I’m using Windows 8.1, Powershell, IDEs Visual Studio Code and Atom.
I’m also having the same issue using ASC11 vertical tab (VT), and the output gives me a male symbol.
I haven’t tried it on Mac or Linux yet.
Apparently, on Windows if you use \f you get the symbol for “female”, and if you use \v you get the symbol for “male”. I have no idea who thought that up over at Microsoft, but it’s weird that \v doesn’t produce the symbol for Venus (the “female”) symbol. These are also super old computing characters so I have no idea why they decided to just change them after 60 years. I’m sure someone in the comments will have a reason why.
Anyway, different terminals will have different support for these escape sequences. These escape sequences are very old, and come from when computing was done on huge printers connected to huge computers like this one:
Those codes were intended to move the printer head and feed mechanism around so you could do very fancy things like draw boxes around columns for you boss to get that big promotion. These printers were a lot like a gigantic typewriter in the beginning, and then evolved to dot matrix, then laser printers, then inkjet, and now we just avoid printers completely unless we have to fax something to an ancient government office that still has one of these things in the basement doing important work.
At one point people figured out that different letters and positions on these printers created different musical tones, and would spend all night figuring out how to print Jingle Bells and other 1950s pop tunes on their printer. That was the 1950s version of Skyrim. I think today if our printers started making music we’d assumed the printer was hacked and throw it in the garbage.
Since nobody really interfaces with a computer through a printer these codes have become mostly obsolete except for \n, \t, and \r in some cases. The \n is a “new line”, and on Unix that’s all you need to move the “print head” (cursor) down one line, and back to the beginning line position. The \t does a tab, which moves the print head (cursor) to the right a certain number of spaces, usually 8 (but if someone uses Emacs then it’s random). Finally, the \r is mostly used on Windows because they decided that \n should only go down to the next line, and \r should “carriage return” to the first position. Basically, Microsoft was being pedantic about “carriage return, line feed” so they made everyone actually explicitly write a \n\r to get the new line. It was one of the very earliest examples of “Well, actually, ” on record (unless you count Leibniz’s writings to Newton).
You’ll find out quite a bit of how computers work now comes from how mainframes worked in the early days of computing. This is why Python’s (every language’s?) files seem so strange to work with, why these escape codes are so weird, and why vi is so awesome. I’ll cover more of this in a later blog post on the history of computing that we still deal with today.
Learn Python 3 The Hard Way is now fully released and ready to download. 12 hours of video covering 52 exercises in Python 3 for beginners. You can buy it at http://bit.ly/buylp3thw and read a free sample at http://bit.ly/lpy3thw to see if you’ll like it before you buy it.
The first thing I’d like to replace is my current Django web stack. It works, and powers my things, but honestly it’s not the greatest functionality. I’d love to just code a replacement in anything else, but my time is limited. I have to work on books right? Gotta record those videos.
A while back I heard that there’s people who hate my books for total beginners because they are too repetitive and slow. Alright, sure, if it’s going too slow then chances are it’s not the right book for you. I actually admit that the book is not for people who can’t handle doing some rote work or are already experts. No book can perfectly train everyone, and it’s insane to expect my book aimed at a person with zero knowledge to also train everyone else.
But, I’m a problem solver, and I like to solve my problems by combining many things at once. Solving one problem is boring. I need to do three at once:
I have a problem that I’d like to learn a new language to do some web development and replace my current Django stack.
I also have the problem that I need to learn a new language for my next book.
I then have this problem that people who feel my beginner books are beneath them seem to think the books don’t work for anyone else.
I believe there is a class of person who feels they can’t learn by practice, but only that they can learn by “building stuff”. I don’t really write books for them, but there was a tickle in the back of my brain that said, “You sure?”
Then it hits me! I got my next book Learn More Python 3 The Hard Way in the works, I need to learn Elixir, well why don’t I just try to do the Learn More exercises in Elixir as my way to learn Elixir? Then when I’m done I’ll have learned enough Elixir to work on my own site, and then I can probably do a Learn Elixir The Hard Way, and then…
Wait! What if I do a “Learn Elixir The Beast Mode Way”, or probably a better title because that’s super weird, but I think you know what I mean. What if I take the projects in Learn More Python The Hard Way, do them in Elixir, then add a large initial “crash course” that teaches enough Elixir to make you dangerous enough to do the projects? Then, the only structure is the projects, and you can do those in almost any order you want.
I’m actually very into this idea now. I freely admit that when you’re an expert that rote practice style of learning isn’t very useful. Learn More Python is kind of the list of projects I work through when I’m learning a new language, so why not just do them with Elixir too?
Starting maybe tomorrow or next week (time permitting) I’m going to “beast mode” Elixir using the projects from my Learn More Python The Hard Way and probably find a place to post the results. I think what I’ll do is go through this awesome Elixir School website as the fast crash course part, then I’ll start going through my book using Elixir. If it works then this may become the new format for future books aimed at people who aren’t total beginners.