Mt. Baker area, March 30, 2017
Some python code in Visual Studio

To IDE or Not to IDE…

When I first learned python, I attended a 3-day “boot camp” and one of the things our instructor asked was that for the duration of the camp, we were only to work from command line and text editors. No IDE, no intellisense, no automagical features like refactoring or spell-check or whatever. We learned the basics this way, created classes, etc., and used Notepad to write our first modules.

Why? Practice makes perfect, and when it comes to writing code, there’s no real substitute for repetition. Get used to making sure you’ve got your dots and colons and balanced your parentheses, or die trying! Of course you’re going to make stupid mistakes like omitting your parentheses in a function signature:

def hello_world:
    print('hello, world!')

And that’s going to give you a nice SyntaxError, which is a learning experience for you!

python SyntaxError
A common python mistake: omitting parentheses in a function signature

And you’re going to forget some import statements, so, another error that you need to learn.

python error NameError due to missing import statement
python error NameError due to missing import statement

Years later, the habit of developing or at least prototyping without an IDE has stuck with me, for better or worse.

For Better

  • It’s one less thing to learn. While that doesn’t sound like a lot, modern IDE are pretty feature-rich and it’s easy to get distracted or overwhelmed. If python is your first language, try learning at least the basics without an IDE.
  • I don’t worry about “Why does this code run in [insert your IDE of choice here] but not in production environment?” (many IDEs set up virtual environments automatically) or dependencies.
  • Relying on IDE features like auto-complete may hinder you from really, deeply learning the language constructs.
  • It helped break habits enabled by IDEs that enable runtime debugging.
  • Being able to work with small snippets into command line, is a useful debugging technique, and this can help you learn how to isolate problems in larger code bases.

For worse

  • I’m probably (ok, definitely) behind the times when it comes to python IDEs.
  • The right IDE can help you learn the language and make you more productive.
  • IDE will help enforce PEP standards and other conventions.
  • Experienced developers have the least to lose in terms of learning & productivity. I did recently use Pycharm (for the first time in 3 or 4 years) to whip up a prototype, and it was really nice having fancy features like I get in Visual Studio working with C#: the built-in Git UI, navigation options, refactoring, etc.

How do I actually work?

Depends on what needs to be done! For relatively simple stuff, I’ll write my class(es) in Notepad++ and fire them up from command-line. For larger projects, I also use Visual Studio (without any specific python support) or VS Code. Even with an IDE, I’ll often mock up a function or class to test via console before spinning up the entire application.

Some python code in Visual Studio
Some python code in Visual Studio

But I still rely principally on logging and error tracebacks for debugging.

And you have to know how to do this, because you won’t have an IDE in a QA or Production environment, and when your application goes sideways, you need to know how to read those logs (you do have logs, right???), errors, reproduce the fault condition in your local environment, debug it, and fix it.

Leave a Reply

Your email address will not be published. Required fields are marked *