Do you want to design a computer program? There's a lot to consider when designing a program, but there are some things you can do to help streamline the process. This minHour teaches you the basic steps to designing a computer program.
Steps
Determine the program’s overall goal.
This is just an overall statement that explains what your program does in one or two sentences. What is the purpose of your program? What problem does it solve? For example, “My program will create a randomized dungeon.”
Determine any limitations or requirements your program has.
Is there anything your program must have? This could be a deadline, budget, storage space and memory restrictions, or a special feature that other similar programs lack. For example, “Randomly generated dungeons must have a pathway from the entrance to the exit.”
Find out if there is any technology that can do what you need.
You don’t always need to design a new program from scratch. Sometimes you can find pre-made programs and tools, or a combination of programs and tools that can accomplish what you need. You can save yourself a lot of time and resource by using existing solutions to problems you encounter.
- For example, you can use open-source programs and pre-made code to construct fully functioning applications. Open-sourced programs are typically free-to-use, and you can modify the source code to fit your needs. You just need to give credit to the author of the original code.
- You can use pre-made pieces of code or open-source applications to save you
Determine which programming language you will use.
It is recommended that you choose a language you are familiar with, if possible. However, in some cases, it may be better to choose a programming language that is more suitable for the intended operating system, or for the type of program you intend to create.
- C/C++ are good general purpose languages. They’re the most widely used languages and give you the most control over your applications and computer hardware.
- C#: C# (pronounced C Sharp) is a newer version of C++. It has some new features and is a little easier to learn that C++.
- Java: Java is a popular object-oriented programming language that is growing in popularity. It is the primary programming language for Android applications. It can also be used to create computer applications. For example, Minecraft was originally programmed in Java.
- Swift: Swift was developed by Apple and is primarily used for developing apps for iPhone, iPad, macOS, Apple TV, and more.
- Python: Python is another popular multi-purpose language. It’s a good language for beginners because it’s easy to learn and use.
Determine what tools you are going to use.
After you decide on a programming language, decide what tools you are going to use. Are you going to be using an integrated development environment (IDE)? Do you need a compiler or interpreter? How will you debug your program? Is there any third-party applications you can use? You should also think of a way to backup your code.
- An IDE is a comprehensive software development tools that contain a code editor, debugger, build tools, and sometimes a compiler. Popular IDE’s include Eclipse, and Visual Studio.
- Compilers:Languages like C/C++ require a compiler to convert the code to machine language your computer can understand. GCC is a free compiler that can compile C and C++.
- Interpreters: Java and Python are languages that do not need to be compiled. However they do need an interpreter to execute the instructions. OpenJDK can interpret Java, which a Python has an interpreter available on their website.
Determine the program’s outputs.
The output of a program is what the program will produces. Every screen the user sees as well as every printed statement or report is considered the programs output. If there is any audio components to the program, that is also considered program. You need to determine what will be on every screen, every printed page, and every field the user will use to input data.
Determine the inputs of your program.
A program’s inputs are the data the program uses to produce it’s outputs. The inputs can come from a user, a hardware device, another program, an external file, or written into the code. Be sure to consider as many of the possibilities as possible, especially when handling user input.
Determine the main functions.
After you’ve determined the inputs and outputs of your program, start creating a basic outline of how it will take the inputs and convert them into outputs. Think about what functions it will need to perform and what calculations it may need. You can create a flow chart outlining the process, or just make a list on paper.
Break larger problems down into smaller problems.
Once you determine what the main functions of your program will be, you can start breaking them down into smaller details. This will help you determine how each function will work. One way to do this is to use pseudo-code.
- Pseudo-code is non-compilable text that explains what each line of code needs to do. For example “If player has gold key, open door. Otherwise, door is closed”.
Start coding the main functions.
They do not have to be filled in. Just make sure they exist. That way you have an outline that helps keep your program organized.
Fill in the functions.
Begin with those that depend on few or no other functions. Work on the big problems first. Then concentrate on the smaller details.
Test your program.
You will need to test your program often. Each time you implement a new function, you’ll need to see if it works properly. Try using a variety of inputs to see how your program works in different situations. Have other people test your program to see how real users interact with your program. Use Print Statements to test different variables and sections of code.
Troubleshoot any problems you run into.
Whenever you are coding, it’s almost certain you will run into a few problems. Here’s a few tips that will help you solve any problems you run into:
- Check the syntax and make sure your code is type right.
- Check and make sure the spelling is correct.
- Google any errors messages your receive and see if there’s a solution.
- Check online to see if anybody else created code with a similar function as yours. See what their solution was.
- Take a break and come back later.
- Ask for help.
Finish your program.
Once you have finished all the functions and you can run your program with a variety of inputs without any errors or crashes, your program is finished. You can turn it in or publish it.