This is a general question, and one that I have yet to find a good solution.
First, some pretext. I’m new to programming and all I have done (mainly anyway) are sequential programs in C.
This leads me to wonder how do big programs such as word, photoshop,visual studio etc. work.
To be less vauge, how do they remain open for one? All the programs I have written are top to bottom, the code runs and then the program terminates. Also What always user to say click save and the file writes or to click font and change the font. Clearly these operations can be performed in any order, infintely many times.
In general I do not see from my limited experiecne how real world applications are made. I want to try and make something “real” or useful, but school has not yet begun to teach me where to start.
Most desktop applications are programmed using a style called event-driven programming. In this setup, the program usually looks (at a very high level) like this:
These “events” tend to be things like mouse clicks, keyboard events, window resizings, etc. Typically, event-driven programs set up windows and attach pieces of code to them so that when an event occurs, the given piece of code can run. Each piece of code that’s attached tends to look exactly like what you’ve seen – it executes from the top to the bottom in a normal fashion. The fact that different events can happen in different orders just means that they run when the user asks them to.
Every language and framework has their own way of handling events, so I’d recommend consulting the documentation for your favorite language / system for more details.
Hope this helps!