I\'ve been learning programming on and off for the past 3 years never dedicating
ID: 654654 • Letter: I
Question
I've been learning programming on and off for the past 3 years never dedicating any meaningful amount of time until recently. Something that has confused me about programming is: How do you start writing a program or an application? I.e. more than just simple code pieces.
Do I just
write and refine the code as I go?
or do I plan the architecture of the code before I even start it, like this class goes here, this method here?
Edit: For clarity, I am not asking about coding conventions (such as proper commenting and format) but about how a programmer approaches a new project.
Explanation / Answer
Basically there are two approaches to this question:
bottom up
top down
They both have their own virtues and can lead to different program structures.
Bottom-up programming is basically about starting to write a program and extending it more and more until is actually does its purpose. top-down programming is about carefully layouting the overall structure of the program and then implementing the details.
Top-down programming needs a fair amount of understanding about the overall structure of the software. Software Patterns have been established in order to avoid common pitfalls and guide the architectural planning into the right direction. Top-down appraoches usually work with Object oriented languages, such as Java, C#, OOP-style C++. Having a plan about the general layout of the software, the remaining work is implementation of the details which can be divided among several programmers. Defining classes and interfaces like java-style OOP encourages simplifies Top-down programming.
Bottom up programming is not free of planning, however you start of writing a central function to your problem by thinking of "the" (or at least one) central task your program has to solve. Then you start implementing auxiliary functions in order to break your problem into smaller ones. In bottom-up programming the aim is to write small one-purpose functions/procedures that can effectively work together to do the whole task. Paul Graham has written an introduction/motivation for bottom-up programming.
Bottom-up programming is really common with Scripting languages and functional programming languages. Top-down programming rather with statically typed Object oriented programming languages.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.