Java for Fucking Idiots: Learn the Basics of Java Programming Without any experience!


Fun fact You could create a String like this if you wanted to make everyone around you cry: String oofOuchOwie = new



Download 3,91 Mb.
Pdf ko'rish
bet63/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   59   60   61   62   63   64   65   66   ...   70
Bog'liq
Java for Fucking Idiots

Fun fact
You could create a String like this if you wanted to make everyone around
you cry:
String oofOuchOwie =
new
java.lang.
String(
"Why?"
);
These are the rules
Just to reiterate, for every Java file:
1. The name of the file should match the Java class, with “.java” at
the end.
2. The file should be placed in a folder structure that matches that
package name (just the folders separated by a period).
3. The top of the file should state the package the class belongs to.
4. Underneath the package statement, the file should import every
class it will need to use.


CHAPTER 13: OBJECT-
ORIENTED CONCEPTS
To wrap up this little book, I’ll give you a brief rundown of some of the
software “design” principles that make a language “Object Oriented,” just
because I like you that much.
Abstraction
You go to a restaurant. You ask for a very nice, expensive meal. The waiter
leaves and returns 20-30 minutes later with your meal.
Where did the waiter get the food from? Did he make it himself? Did he go
to the store and buy it? Did he run to the restaurant across the street and
take it from there?
When you ask for a meal, you don’t walk into the kitchen, tell the chefs
how to prepare it, micromanage how they interact with each other, put the
food into the oven yourself, or swing by Walmart to buy the buns the
restaurant has run out of, etc.
You simply ask the waiter for the food; with the expectation they will
provide it to you.
The waiter has abstracted away the details of how the food is prepared.
Good programmers create classes like this. You might have a very large,
powerful program with dozens or hundreds of classes to do something super
complicated. Maybe you have a program that calculates the quickest way to
travel between Point A and Point B on a map.
But does your user interface need to directly talk to all these different
classes to calculate the route? Or can we create a class that abstracts away


all that complexity? Maybe one class that simply takes address 1 as a
String, address 2 as a String, then returns an array of the steps you need to
take.
This is what abstraction is all about: simplicity of the design that is exposed
to other classes or systems.
Encapsulation
We can enforce abstraction. Classes can simply refuse to expose themselves
out in public. And thank god for that.
You could be a class with 500 properties, 1500 methods, and the worst
spaghetti code in the entire world. But you know what? Other classes don’t
need to see that. They don’t have to care. Encapsulation is a way of
abstracting away our code from other classes.
Let’s say we run a pizza business that lets the customer track the progress of
their order. That customer uses an app installed on their phone.
The app needs to make some network calls over the internet to get updates.
No, you don’t need to worry about that. And that’s part of the point.
Assume that every class used in this stupid example is in a totally different
package.

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   70




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish