Skip to main content

Posts

Showing posts from April 23, 2017

MVC Design Pattern (Model-View-Controller)

ඉතින් යාලුවනේ මම අද ඔයාලට කියන්න යන්නෙ software industrial එකට ගොඩක් වැදගත් වෙන design pattern එකක්. ඒ තමයි MVC එහෙමත් නැත්නම් Model-View-Controller කියන design pattern එක. අපි දැන්  බලමු මොනවද මේ model , view ,controller කියන ඒවායින් කියවෙන්නේ කියලා. Model  : අපි model එකක් කියලා සාමාන්‍යයෙන් කියන්නෙ object එකකට.අපේ program එකේ   ඇතුලත වෙන ක්‍රියාවලිය අපි ඉදිරිපත් කරන්නේ model එකකින්.  View : අපි දැන් බලමු view එකක කියන්නෙ මොකක්දේ කියලා. view එක කියන්නෙ model එකෙ       තියෙන දේවල් user ට පෙන්වන්නේ එහෙමත්මේ නැත්නම් visualise කරන්නේ මේ  view එක හරහා තමයි. Controller : අපි controller කියලා කියන්නෙ model එකේ වෙන වෙනස්කම් view එකේ update   කරන්නේ ඒවගේම model එකයි view එකයි control කරන්නේ මේ controller එකෙන් තමයි. මේ design pattern එකේ මේ කොටසේ තමයි business logic එක අපි ලියන්නේ. හරියට අපේ brain එක වගේ තමයි controller එක ක්‍රියාකරන්නේ.  මේ MVC design pattern එකේ තියෙන ප්‍රධාන වාසියක් තමයි අපි program එකේ ඔක්කොම codes ටික එකම...