Home  • Programming • Java

জাভা প্রোগ্রামিং লেনগুয়েজ হাতেখড়ি- (দ্বিতীয় পর্ব)

object-কি-সাধারনভাবে-objectObject কি ? সাধারনভাবে object বলতে বুজায় কোন বস্তু, আপনি real-world এ অনেক উদাহরণ খুঁজে পাবেন: আপনার desk, আপনার টেলিভিশন, আপনার bicycle একটি অবজেক্ট, বই, কলম, খাতা, কম্পিউটার এগুলো প্রত্যকটিই এক একটি অবজেক্ট। প্রতিটি অবজেক্টের কিছু বৈশিষ্ট থাকে, যেগুলোর জন্য একটি object অন্য একটি object থেকে অলাদা। OOP প্রোগ্রামিং পদ্বতির রান টাইম এনটিটি হল object। object হল software bundle of related state and behavior। objects are key to understanding object-oriented technology। ঠিক আপনার ধারে কাছে দেখুন এবং আপনি real-world বস্তুর অনেক উদাহরণ খুঁজে পাবেন: আপনার পোষা প্রানী, আপনার desk, আপনার টেলিভিশন, আপনার bicycle, গাড়ী ইত্যাদি । Real-world বস্তু দুই গুণাবলিসমূহ ভাগাভাগি করে: state and behavior/অবস্থান এবং আচরণ। পোষা প্রানীর অবস্থান রয়েছে (নাম, রং, breed, ক্ষুধার্ত) এবং আচরণ (barking, আনা হচ্ছে, wagging লিজ)। উদাহরন স্বরূপ Bicycles এর অবস্থান রয়েছে (বর্তমান gear, বর্তমান pedal cadence, বর্তমান গতি) এবং আচরণ (পরিবর্তনশীল gear, পরিবর্তনশীল cadence, applying brakes pedalয়)। অবস্থান সনাক্ত করছে এবং real-world বস্তুর জন্য state and behavior objects is a great way to begin thinking in terms of object-oriented programming. আপনি লক্ষ্য করবেন যে real-world objects vary in complexity আপনার টেবিল ল্যাম্প এর কথাই ধরুন এটি only two possible states (on and off) and two possible behaviors (turn on, turn off) থাকতে পারে , কিন্তু আপনার ডেস্কটপ রেডিওটির কথা ভাবুন radio টিতে additional states (on, off, current volume, current station) and behavior (turn on, turn off, increase volume, decrease volume, seek, scan, and tune). এই real-world পর্যবেক্ষণগুলিই translate into the world of object-oriented programming. প্রত্যেকটি বস্তু লক্ষ্য করুন দেখুন এবং নিজেই দুটি প্রশ্ন করুন: "What possible states can this object be in?" and "What possible behavior can this object perform?".আপনি পর্যবেক্ষণ করে দেখুন যে আপনার ডেস্কটপে যে লাইটটি অছে তা only two possible states (on and off) and two possible behaviors (turn on, turn off)থাকতে পারে।কিন্তু আপনার টিভির ক্ষত্রে অতিরিক্ত states (on, off, current volume, current station) and behavior (turn on, turn off, increase volume, decrease volume, seek, scan, and tune) আপনি ও লক্ষ্য করতে পারেন যে some objects, in turn, will also contain other objects. এই real-world পর্যবেক্ষণগুলি সমস্ত object-oriented প্রোগ্রামিংএ translate করে। চলবে.......

Comments 0


Share

Copyright © 2024. Powered by Intellect Software Ltd