How To Make Your Code Better with Refactor School, Free Episode 1

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:

Or, you can view it on tv.learncodethehardway.com directly.

What is Refactor School?

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.

Free Short Course for Understanding Object Oriented Programming in Python

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:


machine.process(engine.operate().continue())

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:

  1. Variables
  2. Calling functions
  3. Modules
  4. If-statements
  5. Dicts

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:

  1. 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.
  2. 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.
  3. 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.

You can watch the videos below, or go to tv.learncodethehardway.com to view them.

Seminar 1

Seminar 2

Seminar 3

Seminar 4

Seminar 5

Joining Learn Code Live

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.

Python Basics Workshop on Sep 3rd, 2018

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.

So today I’m moving the Python Basics Workshop to September 3rd so people have time to prepare for it and signup.   I’ve also created a separate product for people who only want to attend the Python Basics Workshop #1 and don’t want to signup for the 30 days of Learn Code Live.  If you want to get the 1 week of Python training only, then you can sign up for only that product.

What’s Python Basics Workshop?

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 help@learncodethehardway.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.

Announcing Learn Code:Live

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.

TLDR

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.

Lessons Learned

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:

  1. Streaming live content is a royal pain and full of all kinds of technical issues (which I’ll talk about in another blog post).
  2. 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.
  3. 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.
  4. 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.
  5. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.

What’s in LCLive Now?

Here’s what you get when you sign up for LCLive today:

  • 54 videos for a total of 50 hours and almost 15GB in size.  You can even take a look at what’s available before you join.
  • 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.
  • Many seminars involve watching me code on real things that run my business, but we also cover a huge number of topics from getting your editor setup, to OOP, to advanced javascript hacking.
  • 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.
  • Access to private parts of forum.learncodethehardway.com and priority help from me and other people.
  • 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.

Can I See What It’s Like?

Yes, you can:

How Do You Buy It?

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

This will be included in Learn Code Live and I’m planning on doing one of these every 2 months, so if you want to get the first Python Basics Workshop then signup for LCLive.