KAHIBARO
Discord Login Register

3.6. Code Editors and IDEs

Why Your Editor Matters

When you write backend code, your editor or IDE is where you will spend most of your time. The tool you choose can:

You do not need the most powerful tool to start. You need one that is simple, popular, and well supported. You can always switch later.

There are three broad categories:

CategoryExamplesTypical use
Simple text editorsNotepad, nano, Vim (basic usage)Very small changes, quick edits, servers with no GUI
Code editorsVS Code, Sublime Text, Atom (legacy)Most everyday development, especially for beginners
Full IDEsPyCharm, IntelliJ, Visual StudioLarge projects, heavy refactoring, complex debugging, enterprise workflows

For this course, a code editor or a Python‑focused IDE is ideal.

Always use a code editor or IDE designed for programming, not a general word processor like Microsoft Word or Google Docs. Word processors add hidden formatting that will break your code.

Code Editor vs IDE

Code Editor

A code editor is like a very smart text editor.

Features you usually get:

Popular examples:

IDE (Integrated Development Environment)

An IDE is a complete development environment in one program.

Extra features compared to basic editors:

Popular examples for backend work:

Many modern code editors, especially VS Code, can feel like an IDE once you install enough extensions.

You can think of it like this:

FeatureCode EditorIDE
Syntax highlightingYesYes
Basic autocompleteYesYes
Project treeYesYes
Extensions / pluginsYesYes
DebuggerSometimes, via extensionAlmost always built in
Deep refactoring toolsLimitedExtensive
Language‑specific inspectionsBasicAdvanced
Test integrationSometimesUsually

In this course, we will often mention VS Code and PyCharm, because both are very popular for Python backend work.

Choosing an Editor for Backend Development

When you choose an editor or IDE, consider what you will be doing:

What Beginners Should Look For

Here are useful criteria, especially if you are new:

CriterionWhy it matters for beginners
Easy to installLess time fighting with setup, more time coding
Simple UISo you can focus on learning programming, not learning the editor
Good Python supportBackend work in this course uses Python
Built‑in terminalSo you can run commands without leaving the editor
Git integrationTo learn version control naturally
Large community / tutorialsEasy to find help, guides, and answers

Two excellent options:

You can pick either. Many developers use both for different projects.

Visual Studio Code Basics

Visual Studio Code (VS Code) is a free, open source code editor from Microsoft that runs on Windows, macOS, and Linux.

Installing VS Code

  1. Go to https://code.visualstudio.com/
  2. Download the installer for your operating system.
  3. Run the installer and follow the default options.
  4. Start VS Code.

On first launch, VS Code shows a “Welcome” page with quick links to open a folder, clone a repository, or customize settings.

The VS Code Interface

When VS Code opens, you will see:

AreaDescription
Activity BarVertical bar on the left, icons for Explorer, Search, Git…
Side BarChanges based on the selected activity (files, Git, etc.)
EditorMain area where files open in tabs
Status BarBottom bar, shows language, errors, Git branch, Python env
PanelBottom panel, can show Terminal, Debug Console, Problems

Typical layout for backend work:

Opening a Project Folder

Backend projects usually work with folders, not single files.

To open a project:

  1. Click “File” → “Open Folder…” (or “Open” on macOS).
  2. Choose a folder, for example my-backend-project.
  3. VS Code will show the folder in the Explorer view.

If you are starting from nothing:

  1. Create a folder on your system, for example backend-demo.
  2. Open it in VS Code.
  3. Create a new file inside, like main.py.

Command Palette

The Command Palette is a central feature.

You will use the Command Palette very often, especially for Python and Git operations.

VS Code for Python

To use VS Code for Python backend work, you need to install extensions and choose a Python interpreter or virtual environment.

Python Extension

  1. Click the Extensions icon in the Activity Bar (or press Ctrl+Shift+X / Cmd+Shift+X).
  2. Search for “Python”.
  3. Install the Python extension by Microsoft.

You will notice new features:

Selecting a Python Interpreter

If you installed Python globally or created a virtual environment, VS Code needs to know which interpreter to use.

  1. Open a Python file, for example main.py.
  2. In the bottom Status Bar, you will see something like Python 3.x.x.
  3. Click it or open the Command Palette and search for “Python: Select Interpreter”.
  4. Choose:
    • A virtual environment inside your project folder, for example .venv/bin/python.
    • Or the global Python interpreter if you do not use a virtual env yet.

After selection, VS Code uses that interpreter to:

Writing a Simple Backend Script

Inside main.py:

python
def say_hello(name: str) -> str:
    return f"Hello, {name}!"
if __name__ == "__main__":
    print(say_hello("backend developer"))

Run it from VS Code:

bash
python main.py

You should see:

text
Hello, backend developer!

Later, this main.py might start a web server instead of printing to the console.

Simple FastAPI Example in VS Code

To see how VS Code works with an actual backend:

  1. In the integrated terminal, install FastAPI and Uvicorn:
bash
pip install "fastapi[standard]"
  1. Create app.py:
python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
    return {"message": "Hello, backend!"}
  1. Run the server in the terminal:
bash
fastapi dev app.py
  1. Visit http://127.0.0.1:8000/ in your browser.

VS Code lets you see:

This is exactly how you will develop backend APIs in this course.

Integrated Terminal

Backend work requires frequent command line usage. VS Code has a built‑in terminal so you do not need to keep switching windows.

Opening the Terminal

The terminal opens at the workspace folder, which is usually your project root.

You can:

Example session:

bash
# Create a virtual environment
python -m venv .venv
# Activate it (Windows PowerShell)
.venv\Scripts\Activate.ps1
# Or Linux / macOS
source .venv/bin/activate
# Install dependencies
pip install fastapi "uvicorn[standard]"
# Run your server
uvicorn app:app --reload

With everything inside VS Code, you can quickly switch between editing and running.

Git Integration in VS Code

Backend projects should always use version control. VS Code includes Git integration.

Basic Git Workflow

If you have not initialized Git yet:

  1. Make sure git is installed on your system.
  2. Open your project folder in VS Code.
  3. Open the terminal and run:
bash
git init
git add .
git commit -m "Initial commit"

Now, the Source Control icon in VS Code shows changes.

Using the Source Control View

  1. Click the Source Control icon (looks like a branch).
  2. You will see a list of changed files.
  3. You can:
    • Stage changes (plus icon).
    • Enter a commit message.
    • Click the checkmark to commit.

This is enough for basic version control while you learn more advanced Git in later chapters.

Example: Editing and Committing a Backend File

  1. Change app.py:
python
@app.get("/health")
def health_check():
    return {"status": "ok"}
  1. VS Code shows app.py as modified.
  2. In Source Control view:
    • Stage the file.
    • Write a message like Add health check endpoint.
    • Commit.

You have now versioned a typical backend change: adding a /health endpoint that you might later use with monitoring tools.

Debugging in VS Code

Debugging is essential for backend development. With VS Code, you can set breakpoints and inspect variables instead of only using print().

Setting a Breakpoint

  1. Open your Python file.
  2. Click in the gutter (left of line numbers) next to the line where you want to pause.
  3. A red dot appears, which is a breakpoint.

Example:

python
def calculate_total(prices: list[float]) -> float:
    total = 0
    for price in prices:
        total += price  # Set a breakpoint here
    return total

Running the Debugger

  1. Click the “Run and Debug” icon in the Activity Bar.
  2. Choose “Python File”.
  3. VS Code starts the program and stops at your breakpoint.

Then you can:

This is very helpful when debugging backend logic, for example:

PyCharm for Backend Development

PyCharm is an IDE specifically designed for Python.

Editions

You can start with Community and later decide whether you need more.

Installing PyCharm

  1. Go to https://www.jetbrains.com/pycharm/
  2. Download the Community Edition.
  3. Install it with default settings.
  4. Start PyCharm.

On first launch, PyCharm will ask about UI theme and data sharing preferences. You can accept defaults.

Creating a Python Project

  1. Click “New Project”.
  2. Choose a location, for example backend-demo.
  3. Pick “Python” as project type.
  4. Choose a virtual environment:
    • For beginners, let PyCharm create a new .venv in the project.
  5. Click “Create”.

PyCharm sets up:

You can then right click the project and add a new Python file such as main.py.

Interface Overview

Common parts of PyCharm:

AreaDescription
Project ToolLeft side, shows your files and folders
EditorCenter, where you edit files
Run tool windowBottom, shows run output and test output
TerminalBottom, integrated command line
VCS integrationBuilt in, shows Git changes and history

Running Code

Example main.py:

python
def say_hello(name: str) -> str:
    return f"Hello, {name}!"
if __name__ == "__main__":
    message = say_hello("backend developer")
    print(message)

To run:

PyCharm will:

You can then install FastAPI in the terminal and run servers just like you did in VS Code.

Useful Features for Backend Developers

Regardless of the editor or IDE you choose, certain features are especially useful for backend work.

Syntax Highlighting and Code Formatting

Syntax highlighting helps you read code quickly. Formatting keeps the code consistent.

Example of badly formatted code:

python
def get_user(id:int)->dict:
    return{'id':id,'name':'Alice'}

After formatting:

python
def get_user(user_id: int) -> dict:
    return {"id": user_id, "name": "Alice"}

It is easier to read and maintain.

Code Completion (IntelliSense)

As you type, editors can suggest:

Example with FastAPI and Pydantic:

python
from pydantic import BaseModel
class User(BaseModel):
    id: int
    name: str
def handle_user(user: User):
    user.  # Editor will suggest properties like id, name

This speeds up development and reduces mistakes.

Search and Replace Across Files

Backend projects usually have many files. Search helps you:

Examples of searches you might do:

File Navigation

Features like:

These are very useful in large backend projects with dozens or hundreds of modules.

Refactoring Tools

Refactoring is changing code structure without changing behavior.

Common editor refactorings:

Example: you have repeated code to validate user IDs in multiple endpoints. You can:

  1. Select the repeated lines.
  2. Use “Extract function / method”.
  3. Call the new function from all those places.

This keeps your backend code cleaner and easier to maintain.

Simple Editor Recommendations

For this course, the simplest setup for most beginners:

You may also keep a simple terminal editor installed on your system:

But your main everyday environment should be something like VS Code or PyCharm.

Do not waste too much time trying to find the “perfect” editor. Pick one of the popular options, learn its basics, and focus your energy on learning backend concepts and writing code.

Example: Typical Backend Developer Workflow in an Editor

To connect everything, here is a small, realistic sequence using VS Code, but PyCharm would be similar.

  1. Open the project folder my-backend-api.
  2. Select the Python interpreter (your virtual environment).
  3. Install dependencies in the integrated terminal:
bash
   pip install fastapi "uvicorn[standard]" sqlalchemy
  1. Create or edit files:
    • main.py for FastAPI application.
    • db.py for database connection.
    • models.py for database models.
  2. Use autocomplete to import FastAPI and Pydantic correctly.
  3. Run the server from the terminal:
bash
   uvicorn main:app --reload
  1. Check logs in the terminal as you hit endpoints with a browser or HTTP client.
  2. Set breakpoints to debug logic inside route handlers.
  3. Use Git integration to commit changes after a feature or fix.
  4. Search across files when you modify an endpoint name or move shared logic.

Once you are comfortable with these actions, your editor or IDE becomes a powerful ally, and you can focus more on backend design, performance, and security which you will learn in later chapters.

Views: 8

Comments

Please login to add a comment.

Don't have an account? Register now!