What is an IDE?
An integrated development environment (IDE) is software that consolidates various programming tools into one package. IDEs streamline the coding process by combining multiple aspects of writing software: editing source code, building executables, and debugging.
An IDE consists of:
- Source code editor - A text editor used for writing software code. Often includes helpful features such as syntax highlighting, language-specific auto-completion, and bug checking.
- Build automation - compiles the source code from a high-level language to a lower level language to create an executable program, and then runs automated tests.
- Debugger - allows programmers to examine different variables and inspect their code when an error occurs.
Some additional features that a good IDE might offer:
- Syntax highlighting - an IDE that knows the syntax of your language can provide helpful visual cues. For example, variables will be highlighted in one color, while function calls will be highlighted in another.
- Intelligent code completion - an IDE can anticipate what you’re typing and provide autocomplete suggestions. This saves keystrokes and helps to prevent typos. It can also query the parameters of functions when you call them.
- Automated refactoring - assisting in cleaning up code and restructuring it to eliminate bugs and increase stability.
- Version control - software (such as Git) for tracking changes in source code, usually used for coordinating work among collaborating programmers.
IDEs save time and minimize headaches. It’s possible to develop programs without one, but their convenience and efficiency make them essential in a professional environment. For this course, we’ll use Microsoft Visual Studio Code. It’s free, open source, and supports a wide range of programming languages and extensions.
Setting up visual studio code (VS code)
- Download and install Visual Studio Code - Go to https://code.visualstudio.com/ and download the appropriate version for your operating system. Then, follow the installation instructions.
- Install the Python extension - Open VS Code and click on the Extensions icon on the left-hand side of the screen. Search for "Python" and click on the Python extension by Microsoft. Click the "Install" button and wait for the installation to complete.
- Open a new Python file - Click on "File" in the top menu bar and select "New File". In this new file, type the following code:
Then, save the file as Hello.pyprint("Hello, world!")
- Configure the Python interpreter - Click on the gear icon in the bottom left-hand corner of the screen and select "Python". Then, click on the drop-down menu next to "Python: Select Interpreter" and choose the version of Python you have installed on your computer.
- Run your Python program - In the VS Code terminal (which should be at the bottom of the screen), type "python" followed by the name of your Python file. It should look like this:
Press “Enter”. Your program should run in the terminal and output any results. In this simple example, you should see “Hello, world!” in the terminal. Alternatively, hit the F5 key to run and debug whatever program you’re currently working on.python3 Hello.py