0% found this document useful (0 votes)
34 views6 pages

How Does An App Work

The document provides an overview of how mobile apps work, describing the three main components of apps: the user interface, code, and data. It explains how the operating system manages resources and notifies apps of user interactions and other events like phone calls. The goal is to understand all aspects involved in building mobile apps that can respond appropriately to different scenarios.

Uploaded by

Duane Luy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

How Does An App Work

The document provides an overview of how mobile apps work, describing the three main components of apps: the user interface, code, and data. It explains how the operating system manages resources and notifies apps of user interactions and other events like phone calls. The goal is to understand all aspects involved in building mobile apps that can respond appropriately to different scenarios.

Uploaded by

Duane Luy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

This is Angela from the app brewery.

And before we get started digging in and building apps the first thing I want to talk about is how exactly 3

does an app work. 4

Because we'll have it in our phones we use it to do really important things like banking and contacting 5

friends. 6

But there are actually very few people who know just exactly how an app actually works. 7

So let's start off by getting an overview of that. 8

Now the first thing we have to realize is that smartphones are actually no different from just any other 9

computer and an app is just code that we write to tell that mini computer what it should do. 10

So let's say we have an app that just has a single button on it that says Click me when the user taps 11

on the screen of that phone. 12

Then the sensors in the phone register that tap and sends a message to the operating system which in 13

the case of an iPhone would be iOS. 14

Now the operating system then looks at the data that it gets from the sensor including things such as 15

how much pressure was applied onto the phone at which location on the phone screen did it register that
16

pressure and a whole bunch of different things and a whole lot of numbers. 17

But the operating system takes all of those numbers and makes sense of it. 18

And once it does then it will know that this particular button on the screen of this particular app 19

was tapped at this time point and then he'll send a message to the app in question telling it that hey 20

this button of yours got tapped. 21

What should it do? 22


And so the code that you write for your app should specify in this situation when the button called 23

Click me gets tapped, 24

this is what it should do. 25

It should change what's shown on screen. 26

And it should do this and that and that. 27

So essentially as an app developer you're planning out all of the scenarios and what should happen. 28

In each case was almost a bit like emergency planning if the building is on fire. 29

What should happen. 30

Well we should probably evacuate the staff and we should probably shut all the doors to prevent the 31

fire from spreading. 32

Well it's exactly the same for apps. 33

What should happen when a user taps on this particular button? 34

Well we should change the screen background to red. 35

We should show them some other pieces of information and then we'll wait to see what the user does
next. 36

And then there's a plan for how to respond to the next event. 37

So this essentially only three components to every single mobile app. 38

There are the user interface elements that you see on screen, so those can be things such as buttons or
39

images or toggles and sliders. 40

And when we first build our app we're going to set up the screen. 41

So we're going to drag on some buttons and place it in a location that we think makes sense and then 42
add images or add other interface elements to the screen. 43

Now when those elements get interacted with by the user say somebody taps on the button then we've
got 44

the second component of the app that comes into play which is the code and this code is the plan. 45

If this button called click me gets tapped on, then what's the next thing that should happen? 46

Well, it's step one do this. Step to do that. Step three do that. 47

But if the user, say, used the slider then in our code there'll be a section that plans for what should 48

happen when the user uses the slider. 49

And finally most of the apps especially if it gets more complex will have data that's stored in the 50

app. 51

So for example let's say we have a contact management app right where we have all the phone numbers
52

of all of your friends and colleagues. Well on the screen when the user taps on a button that says Show
53

me Bob's phone number. 54

Then that will send a message to our code and we check through all of those lines of code to see how 55

we should respond when the user taps on that button and the code will go into the data and fetch the 56

relevant piece of data. 57

So in this case that's of course Bob's phone number. 58

And then it's going to send it back onto the screen and display it on the screen so that the user now 59

sees the telephone number of Bob. 60

Now previously I mentioned that a smartphone is just like a small computer but there's still a few crucial
61
differences. 62

The first difference is that a laptop or desktop computer is usually plugged into the wall but a phone 63

on the other hand is usually wireless. 64

We usually keep it in our pocket and it's not always charging. 65

It's also a lot smaller. 66

So the battery gets depleted much faster compared to a laptop. 67

Now a phone also has less processing power. 68

So if you tried to play something that's really intensive on your phone say the latest Far Cry or if 69

you try to run Photoshop on your phone then it's not going to be able to do it. 70

Because it has less memory and less processing power than your computer. 71

So because the phone has limited resources on all of these fronts then in order for a user to actually 72

have a good time using their iPhone, then we have to manage those resources very frugally. 73

So for example you can't just make an app that drains the user's power in five minutes or make an app 74

that's so demanding on processing power that it's so slow and barely chugs along on the phone. 75

So in all smartphones, there's always a manager -somebody to manage all of those resources. 76

And that is of course the operating system. 77

So it's iOS in our case that we need to worry about. And this manager is a little bit like the factory 78

boss. 79

It tells our app "Hey, you're about to come on screen now." 80

"Get ready." 81

"The user wants to see something from you." 82


"Don't let me down". Or it might say "Hey! You're draining the battery way too much." 83

"I'm going to have to shut you down" or "Hey you, little app, the user is getting a phone call right now" 84

"and I'm going to have to switch you off." 85

"Make sure you save their data before you go home." 86

And this is what I think about every time I see my apps shuddering and shaking in fear. 87

So previously we looked at the three components that make up any app namely the screen, the code, and
88

the data. 89

Well we actually have to zoom out a little bit and see the bigger picture which includes the role of 90

the operating system. 91

So when we think back to that plan that we're writing when we're coding up the apps, then that plan has
92

to take into account all of the events that happen not just when a button inside the app is tapped or 93

when the user shakes the phone when our app is open but also things such as when the operating
system 94

tells us that the user is getting a phone call. 95

So our app is going to be switched into the background. 96

So we have to also plan ahead for those situations. 97

Well if the user is getting a phone call but they were midway through filling out a long form inside our 98

app, we don't want them to come back after the call and realize all of that data has been lost. 99

So we have to plan on how we save that data when a user gets a call for example. 100

So all in all when we build an app we're essentially writing a very long and very extensive plan to 101
plan for what should happen under lots of possible scenarios. 102

And when the app is launched on the phone it looks to this plan to see what it should do. 103

So, in the course we're going to be digging into every single aspect that we spoke about in this lesson
104

and this is a little bit of a teaser of what's yet to come and what you're going to be learning about. 105

So that by the end of the course you'll understand exactly how the app works and build any app that 106

you dream of.

You might also like