wordpress-seo
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/ilkinalibayli/public_html/wp-includes/functions.php on line 6114Dem\u0259k olar ki h\u0259mi\u015f\u0259 OYP-dan (Obyekt Y\u00f6n\u00fcml\u00fc Proqramla\u015fd\u0131rma) istifad\u0259 ed\u0259n proqram\u00e7\u0131 m\u00fcsahib\u0259l\u0259rind\u0259 n\u0259inki OYP haqq\u0131nda, h\u0259m\u00e7inin SOLID prinsipl\u0259ri haqq\u0131nda soru\u015furlar. Bu prinsipl\u0259ri keyfiyy\u0259tli kod yazmaq \u00fc\u00e7\u00fcn bilm\u0259k \u00e7ox vacibdir. Ona g\u00f6r\u0259 bu m\u0259qal\u0259d\u0259 sizl\u0259r\u0259 SOL\u0130D prinsipl\u0259rini asan formada izah etm\u0259y\u0259 \u00e7al\u0131\u015facam.<\/p>\n\n\n\n
Obyekt Y\u00f6n\u00fcml\u00fc Proqramla\u015fd\u0131rma proqram\u00e7\u0131lara imkan yarad\u0131b ki, onlar bir birin\u0259 ox\u015far mahiyy\u0259tl\u0259ri (entity) bir birin\u0259 ba\u011flaya bilsinl\u0259r. Amma OYP-nin istifad\u0259si keyfiyy\u0259tli kod bazas\u0131n\u0131 t\u0259min etmir.<\/p>\n\n\n\n
Qar\u0131\u015f\u0131q, ayd\u0131n olmayan v\u0259 \u00e7\u0259tin saxlan\u0131lan kod h\u0259tta OYP il\u0259 d\u0259 yaz\u0131la bil\u0259r.<\/p>\n\n\n\n
Keyfiyy\u0259tli proqramlar haqq\u0131nda yazan m\u0259\u015fhur kitab m\u00fc\u0259llifi Robert Martin (uncle Bob) 5 \u0259sas OYP prinsipini yaratm\u0131\u015fd\u0131. Bu prinsipl\u0259r SOLID kimi adland\u0131r\u0131l\u0131blar.<\/p>\n\n\n\n
S<\/strong> – Single Responsibility Principle \u0130lk bax\u0131\u015fdan b\u00fct\u00fcn bu s\u00f6zl\u0259r \u00e7\u0259tin v\u0259 qar\u0131\u015f\u0131q g\u00f6r\u00fcn\u00fcr, amma \u0259slind\u0259 bel\u0259 deyil.<\/p>\n\n\n\n M\u0259nim fikirimc\u0259, bir \u00e7ox kod bazas\u0131n\u0131n hiss\u0259sini asanl\u0131qla d\u0259yi\u015fib ba\u015fqa t\u0259r\u0259fini s\u0131nd\u0131rmam\u0131s\u0131n\u0131zsa, dem\u0259li kodunuz keyfiyy\u0259tlidir. Klass yaln\u0131z bir tap\u015f\u0131r\u0131qa m\u0259suliyy\u0259t da\u015f\u0131mal\u0131d\u0131r. \u018fg\u0259r bir klass bir ne\u00e7\u0259 bir birin\u0259 aid olmayan tap\u015f\u0131r\u0131qlar\u0131 yerin\u0259 yetir\u0259rs\u0259, onu varis (inherit) ed\u0259n klasslar bir birin\u0259 b\u0259rk ba\u011flanacaqlar. Bizim Computer adl\u0131 klass\u0131m\u0131z var, hansi ki \u00f6z daxilind\u0259 bir ne\u00e7\u0259 funksiya (method) saxlayir<\/p>\n\n\n\n
O<\/strong> – Open-Closed Principle
L<\/strong> – Liskov Substitution Principle
I<\/strong> – Interface Segregation Principle
D<\/strong> – Dependency Inversion Principle<\/p>\n\n\n\nKeyfiyy\u0259tli, yax\u015f\u0131 kod n\u0259dir?<\/h3>\n\n\n\n
Koda yeni funksionall\u0131\u011f\u0131n \u0259lav\u0259 etm\u0259 s\u00fcr\u0259ti ill\u0259r boyu eynidirs\u0259, dem\u0259li kodunuz \u00e7ox yax\u015f\u0131 yaz\u0131l\u0131b.
Kodun yax\u015f\u0131 qalmas\u0131 \u00fc\u00e7\u00fcn, proqram modullar\u0131n aras\u0131ndaki qo\u015fulmalar\u0131 minimuma azaltmal\u0131y\u0131q.
G\u0259lin SOLID prinsipl\u0259rin\u0259 bir bir baxaq:<\/p>\n\n\n\nSingle Responsibility Principle<\/h2>\n\n\n\n
V\u0259 bu varis olunan klasslardan birind\u0259 d\u0259yi\u015fiklik etdikd\u0259 ba\u015fqalar\u0131nda da etm\u0259li olacay\u0131q. Bu is\u0259 o dem\u0259kdir ki, kodun keyfiyy\u0259ti pisl\u0259\u015fdi.
Bu m\u0259qal\u0259d\u0259 b\u00fct\u00fcn m\u0259s\u0259l\u0259l\u0259r abstrakt olacaq, kodsuz.
G\u0259lin bir misala baxaq:<\/p>\n\n\n\n