Spaghetti Coupling
<
body
>
php
$users
=
mysqli_query(
'SELECT * FROM users'
);
?>
foreach
(
$users
as
$user
)
:
?>
-
=
$user
[
'name'
]
?>
endforeach
;
?>
This example, which is very similar to our first example of code with poor architecture, has a
lot of coupling. Can the application function in any respect without the database? No, we have
queries all over the code. It is highly coupled to the database.
Can the application function without a web browser? Well, technically yes, but who wants to
read straight HTML? Can we get a list of users without it being formatted in HTML? No, we
cannot. Our application is highly coupled to the browser.
OOP Coupling
Coupling, The Enemy
15
Do'stlaringiz bilan baham: |