MYSTERY ZILLION တွင် English သို့မဟုတ် Unicode ဖြင့်သာ အသုံးပြုခွင့်ရှိသည်။ ဇော်ဂျီ ၊ ဧရာ စသည်တို့ကို အသုံးပြုခွင့် မရှိ။ Unicode Guide ကို ဒီမှာ Download ချပါ။ Zawgyi to Unicode Converter
Don't share ebook or software if nobody request. You can find free book websites on here. We are welcome for discussion or asking question instead.
Please explain OOP Concepts !!!
  • Vote Up2Vote Down htun linn aunghtun linn aung
    Posts: 10Registered Users
    Please explain OOP concepts and why use it ?
    I already read oop ebooks but I am cofusion on that weird,so I request to MZ's bro explain about that.
  • 8 မှတ်ချက်များ sorted by
  • Vote Up2Vote Down PhyoMyanmarPhyoMyanmar
    Posts: 67Registered Users

    ကျွန်တော်သိသလောက်လေး ပြောပြမယ်နော် ...
    မှားတာရှိရင်လည်း ခွင့်လွှတ်ပေးကြပါ :D

    OOP ကိုဘာလို့သုံးရသလဲ ဆိုတော့ အဓိက သူ့ရဲ့ Feature သုံးမျိုးရချင်လို့ပါ
    ဘာတွေလဲဆိုတော့

    ( 1 ) Encapsulation ( ဖုံးအုပ်ခြင်း )
    ( 2 ) Inheritance ( အမွေဆက်ခံခြင်း )
    ( 3 ) Polymorphism ( အသွင်ပြောင်းလဲခြင်း )

    ဒီသုံးမျိုးလုံးကို အပြည့်အဝရမှာသာလျှင် ထို Language က OOP စစ်တယ် ၊ တနည်း Pure OOP လို့ပြောလို့ရမှာပါ

    (1)Encapsulation ဘာအတွက်သုံးလဲဆိုတော့ Data Validation ကောင်းဖို့အတွက်ပါ ၊
    (2)Inheritance ကကြတော့ ရှိပြီးသား Class ရဲ့ Features တွေအပြင် မလိုချင်တာတွေ ဖြုတ် ၊ လိုချင်တာတွေ ပေါင်းထည့် နိုင်ပါတယ်
    အဓိကကတော့ reuse ပြန်သုံးနိုင်တာပဲ Same Function တွေရတာပဲ မိဘဆီက သားသမီးတစ်ယောက်အမွေတွေရသလိုပေါ့ ၊
    (3)Polymorphism ကတော့ အရေးကြီးဆုံးပဲ ၊
    ဘာကောင်းလဲဆိုတော့ Extensibility ကောင်းတယ် ၊ Same Command နဲ့ Different Behavior ရရှိနိုင်တယ်
    ဥပမာ - Boss က သူ့အလုပ်မှာ သန့်ရှင်းရေးသမားကို မင်းတံမြက်စည်းလှည်း ၊ စာရင်းကိုင်ကို မင်း စာရင်းတွက် ၊
    Programmer ကိုမင်း Program ရေး ... စသဖြင့်လိုက်ပြောစရာမလိုပဲ ... မင်းတို့ အလုပ်လုပ်ကြ လို့တစ်ခွန်းထဲပြောလိုက်တာနဲ့တူတူပါပဲ

    ဒီတော့ သန့်ရှင်းရေးသမားကလည်း သူ့ဟာသူ တံမြက်စည်းလှည်းမယ် ၊ စာရင်းကိုင်ကလည်း တွက်မယ် ၊ Programmer ကလဲ Code တွေရေးမယ်
    ဒါကတော့ Polymorphism ရဲ့ အကျိုးကျေးဇူးပေါ့ ၊ အခုပြောနေတာတွေက အတိုချုံး ပြောလိုက်ခြင်းသာဖြစ်ပါတယ် ၊ :D


    ------------------------
    OOP မသုံးရင်တော့ ရေးလို့မရဘူးလားဆိုတော့ ရပါတယ် ၊ ဒါပေမဲ့ Project ကြီးတွေ Enterprise Level တွေဆိုရင်တော့
    OOP နဲ့ရေးမှ အဆင်ပြေမှာဖြစ်ပါတယ် ၊
    Real World မှာ ရှိနေတဲ့ Object ( အရာဝတ္တု )တိုင်းကို အခြေခံတဲ့အတွက် စဉ်းစားရာမှာလဲ ပိုမိုလွယ်ကူစေပါတယ် ၊

    OOP 's way of Thinking
    ===============
    Object --> Class
    Property -- > Variable
    Function --> method

    အပြင်လောက ( Real World ) မှာရှိတဲ့ Object တိုင်းကို Class အဖြစ်သတ်မှတ်ပါတယ် ၊
    လူ ၊ TV ၊ ဘောပင် ၊ ... တော်တော်များများက Noun နဲ့ဖြစ်ပါတယ် ၊ မဖြစ်တာတွေလဲရှိတယ် ၊

    Property ကို Field / attribute လို့လဲခေါ်ကြပါတယ် ၊ သူကတော့ Object ရဲ့ Property ပဲဖြစ်ပါတယ်
    င်္Function ကို Behavior လို့လဲခေါ်ကြပါတယ် ၊ သူကတော့ Obj ရဲ့ လုပ်နိုင်တဲ့အရာတွေပဲဖြစ်ပါတယ်

    ဥပမာ - Monitor တစ်လုံးဆိုရင် Monitor က obj
    သူရဲ့ Property ဆိုရင် မော်ဒယ်တို့ ၊ တံဆိတ်တို့ Resolution တို့ Ratio တို့ပါ
    Function ဆိုရင်တော့ ပိတ်နိုင်တယ် ဖွင့်နိုင်တယ် ၊ မှိန်ထားနိုင်တယ် ၊ လင်းနိုင်တယ် ပေါ့

    ****
    :D
  • Vote Up1Vote Down CalmHillCalmHill
    Posts: 1,177Super Moderators
    saturngod said:


    1. Encapsulation
    2. Inheritance
    3. Polymorphism



    Polymorphism example is wrong, type of animals[0] is Cat and animals[1] is Dog. Cat is calling own talk() and Dog is also the same. So that is not Polymorphism. Python does not need to type cast, there will not be proper Polymorphism example.

    Python will be limited to learn all OOP concept. Variable scope will be difficult to understand, for example protected concept. Java will be the most appropriate for learning OOP.
  • Vote Up0Vote Down saturngodsaturngod
    Posts: 4,599Administrators
    http://www.mysteryzillion.org/discussion/4069/object-oriented-software-engineering

    ကို လည်း ဖတ်ကြည့်သင့်ပါတယ်။


    အခုတော့

    1. Encapsulation
    2. Inheritance
    3. Polymorphism

    ကို ပဲ ကျွန်တော် ထပ်ရှင်းပြပါမယ်။

    Encapsulation ဆိုတာကတော့ Private , Protected , Public စတဲ့ လုပ်ပိုင်ခွင့်တွေပေါ့။

    ဥပမာ။။ Bank Account Object ဆိုပါတော့ ။

    Bank Account မှာ

    - protects read account function
    - private write account function
    - public Account Read Name

    တွေ ရှိတယ်ဆိုပါတော့

    ကျွန်တော်တို့တွေက Bank Account က Name ကို ဘယ်သူမဆို ဖတ်လို့ရတယ်။

    read account ကတော့ Bank Account ကိုယ်တိုင်နဲ့ သူ့ကို Inheritance လုပ်ထားတဲ့ Class တွေမှ ဖတ်လို့ရပါတယ်။

    private ကတော့ သူ့ class ကိုယ်တိုင်ပဲ ဖတ်လို့ရပါတယ်။


    Inheritance ကတော့ Class တစ်ခု ရဲ့ child ပေါ့။


    Saturngod Bank Account က Bank Account ရဲ့ child ဖြစ်ပါတယ်ဆိုပါဆို့။

    Saturngod Bank Account က name နဲ့ read account ပဲ အလုပ်လုပ်ခွင့်ရှိတယ်။ write ခွင့်တော့ မရှိဘူးပေါ့။



    code အနေနဲ့ python နဲ့ ပြထားတယ်။


    class SquareSumComputer:
    def __init__(self, a, b):
    self.a = a
    self.b = b

    def transform(self, x):
    return x * x

    def inputs(self):
    return range(self.a, self.b)

    def compute(self):
    return sum(self.transform(value) for value in self.inputs())

    class CubeSumComputer(SquareSumComputer):
    def transform(self, x):
    return x * x * x


    SquareSumComputer မှာ transform, inputs, compute ဆိုတာပါတယ်။ CubeSumComputer က Inheritance လုပ်ပြီးတော့ transform ဆိုတဲ့ function လေးပဲ ပြင်တယ်။ ကျန်တာတွေကတော့ SquareSumComputer function မှာပါတဲ့ အတိုင်းပဲ။ ဒါ့အတွက်ကြောင့် function တွေအကုန် CubeSumComputer မှာ ပြန်ရေးနေစရာ မလိုတော့ဘူး။


    Polymorphism ကတော့ interface သဘောမျိုးပေါ့။ ဒီ function ကို ထပ်ပြီး ဆင့်ဖွားတာ ကိုယ်တိုင်ဖန်တီးတာပေါ့။ အောက်မှာ python နဲ့ ရေးထားတာ တချက်ကြည့်လိုက်ပါ။



    class Animal:
    def __init__(self, name): # Constructor of the class
    self.name = name
    def talk(self): # Abstract method, defined by convention only
    raise NotImplementedError("Subclass must implement abstract method")

    class Cat(Animal):
    def talk(self):
    return 'Meow!'

    class Dog(Animal):
    def talk(self):
    return 'Woof! Woof!'

    animals = [Cat('Missy'),
    Dog('Lassie')]

    for animal in animals:
    print animal.name + ': ' + animal.talk()


    Animal မှာ talk ဆိုတဲ့ function ရှိတယ်။ ဒါပေမယ့် implement မလုပ်ထားဘူး။

    Cat က ကိုယ်ပိုင် အသံ Dog ကလည်း ကိုယ်ပိုင် အသံ ထွက်တယ်ပေါ့။ သူတို့ဘာသာ သူတို့ implement လုပ်ထားတာ။


  • Vote Up0Vote Down PhyoMyanmarPhyoMyanmar
    Posts: 67Registered Users
    Yes ... Java is the most appropriate for learning OOP

    :D
  • Vote Up0Vote Down CalmHillCalmHill
    Posts: 1,177Super Moderators

    Yes ... Java is the most appropriate for learning OOP

    :D


    Can you list down why do you agree? The most appropriate does not mean the best and complete. Need to use several languages to understand OO concepts.

  • Vote Up0Vote Down htun linn aunghtun linn aung
    Posts: 10Registered Users
    Yeah!thank bro for answering mystery,please continue about of that weird.
    By sample code.
    Welcome MZ's member to discuss this thread.
  • Vote Up0Vote Down CalmHillCalmHill
    Posts: 1,177Super Moderators

    Yeah!thank bro for answering mystery,please continue about of that weird.
    By sample code.
    Welcome MZ's member to discuss this thread.



    1. Find any OOP book (If you can provide your programming knowledge, I'll happy to suggest suitable book)
    2. Read it, try to understand the concept and try to run the samples
    3. Come back to MZ when you couldn't understand or couldn't imagine the concept
    4. MZ will be happy to help and answer when we saw that somebody is working hard.

  • Vote Up0Vote Down htun linn aunghtun linn aung
    Posts: 10Registered Users
    Yeah,bro CalmHill.
ဆွေးနွေးမေးမြန်းခြင်းစတင်ရန်

မင်္ဂလာပါ!

လှိုက်လှဲစွာကြိုဆိုပါသည်။ ယခု ပထမဆုံးအကြိမ် ရောက်ဖူးခြင်းဖြစ်ပါသလား? ဝင်ရောက် ဆွေးနွေး မေးမြန်းလိုပါလျှင် အောက်တွင်ဖော်ပြထားသော button များမှတဆင့် ဝင်ရောက် ဆွေးနွေးနိုင်သကဲ့သို့ အဖွဲ့ဝင်အသစ်အနေဖြင့်လည်း လျှောက်ထားနိုင်ပါတယ်။

Facebook ဖြင့်ဝင်ရန် Google ဖြင့်ဝင်ရောက်ရန် OpenID ဖြင့်ဝင်ရောက်ရန် Twitter ဖြင့်ဝင်ရောက်ရန်

အမျိုးအစားများ

In this Discussion

Tagged