[INTRO] Duration: 30 seconds
“Hey guys, welcome back to our channel! Aaj hum baat karenge ek bahut hi interesting topic ke baare mein – Programming Paradigms! Agar aap programming seekh rahe hain ya software development mein interest rakhte hain, toh ye video aap ke liye hai. Toh bina time waste kiye, chaliye shuru karte hain!”
[SECTION 1: Introduction to Programming Paradigms] Duration: 1 minute
“Sabse pehle, samajhte hain ki Programming Paradigm hota kya hai. Basically, programming paradigm ek style ya approach hai jismein aap apni code likhte hain. Jaise ki hum alag-alag tarike se problem ko solve kar sakte hain, waise hi programming mein bhi alag-alag paradigms hain jo problems ko solve karne ke different approaches dete hain. Common paradigms hain:
- Procedural Programming
- Object-Oriented Programming (OOP)
- Functional Programming
- Logical Programming
Chaliye, ab inhe detail mein samajhte hain.”
[SECTION 2: Procedural Programming] Duration: 2-3 minutes
“Sabse pehle, Procedural Programming. Yeh paradigm ek step-by-step approach follow karta hai jahan code ko ek sequence mein likha jata hai. Jaise aap instructions dete hain ki pehle yeh karo, fir yeh, aur phir yeh.
Example: Maan lo, aapko ek program likhna hai jo kisi student ke marks ko input le kar average calculate kare:
def calculate_average(marks):
total = sum(marks) # Sabhi marks ko add kar ke total calculate kar rahe hain
average = total / len(marks) # Total ko number of subjects se divide kar ke average nikal rahe hain
return average
marks = [80, 90, 75, 85, 92]
print("Average Marks:", calculate_average(marks))
Explanation:
calculate_average
ek function hai jo marks ko input le kar unka total aur average calculate karta hai.sum(marks)
: yeh sabhi marks ko add karta hai.len(marks)
: yeh number of subjects count karta hai.- Finally, function average return karta hai.
Example in C++:
#include <iostream>
using namespace std;
double calculateAverage(int marks[], int size) {
int total = 0;
for (int i = 0; i < size; i++) {
total += marks[i]; // Total sum kar rahe hain sabhi marks ka
}
return static_cast<double>(total) / size; // Average calculate kar rahe hain
}
int main() {
int marks[] = {80, 90, 75, 85, 92};
int size = sizeof(marks) / sizeof(marks[0]);
cout << "Average Marks: " << calculateAverage(marks, size) << endl;
return 0;
}
Explanation:
calculateAverage
function marks array ko input leta hai aur average return karta hai.- Loop ke zariye sabhi marks ka total calculate hota hai.
- Average nikalne ke liye total ko size se divide karte hain.
“Dono examples mein, Python aur C++ code ek step-by-step approach follow karta hai – pehle total calculate hota hai, phir average, aur fir result print hota hai.”
[SECTION 3: Object-Oriented Programming (OOP)] Duration: 4-5 minutes
“Ab baat karte hain Object-Oriented Programming ki, yaani OOP. Is paradigm mein hum real-world entities ko objects ke roop mein code karte hain. Objects ek class ke andar define kiye jaate hain, aur unke paas attributes (properties) aur methods (functions) hote hain.
Example in Python:
class Car:
def __init__(self, brand, model):
self.brand = brand # Car ka brand set kar rahe hain
self.model = model # Car ka model set kar rahe hain
def start(self):
print(f"{self.brand} {self.model} is starting...") # Car start ho rahi hai
my_car = Car("Toyota", "Corolla") # Ek object bana rahe hain Car class ka
my_car.start() # Object ka method call kar rahe hain
Explanation:
Car
ek class hai jo blueprint define karti hai car object ke liye.__init__
method se car ke brand aur model set hote hain jab object create hota hai.start()
method car ke brand aur model ko use karke ek message print karta hai.my_car
ek instance haiCar
class ka joToyota Corolla
ko represent kar raha hai.
Example in C++:
#include <iostream>
using namespace std;
class Car {
private:
string brand;
string model;
public:
Car(string b, string m) {
brand = b; // Car ka brand set kar rahe hain
model = m; // Car ka model set kar rahe hain
}
void start() {
cout << brand << " " << model << " is starting..." << endl; // Car start ho rahi hai
}
};
int main() {
Car myCar("Toyota", "Corolla"); // Ek object bana rahe hain Car class ka
myCar.start(); // Object ka method call kar rahe hain
return 0;
}
Explanation:
Car
class define karti hai brand aur model ke attributes.- Constructor se car ka brand aur model set hota hai jab object create hota hai.
start()
method car ka naam print karta hai jab usse call kiya jata hai.myCar
ek instance haiCar
class ka joToyota Corolla
ko represent karta hai.
“OOP ki strength yeh hai ki aap code ko reuse kar sakte hain aur complex systems ko organize kar sakte hain.”
[SECTION 4: Functional Programming] Duration: 2-3 minutes
“Teesra paradigm hai Functional Programming. Jaise naam se pata lagta hai, isme main focus hota hai functions par. Functions ko aise likha jata hai ki unka koi side-effect na ho, aur woh ek input lekar ek output hi return karen.
Example in Python:
def add_numbers(a, b):
return a + b # Input do aur sum le lo
result = add_numbers(5, 7)
print("Sum:", result)
Explanation:
add_numbers
function ko do numbers diye jaate hain aur woh unka sum return karta hai.- Is approach mein har function ka ek specific kaam hota hai, jo Functional Programming ka basic principle hai.
Example in C++:
#include <iostream>
using namespace std;
int addNumbers(int a, int b) {
return a + b; // Input le kar sum return karte hain
}
int main() {
int result = addNumbers(5, 7);
cout << "Sum: " << result << endl;
return 0;
}
Explanation:
addNumbers
ek simple function hai jo do numbers add karta hai.- Function call
main()
function ke andar hota hai aur result print hota hai.
“Functional Programming ka fayda yeh hota hai ki aapki code predictable aur maintainable hoti hai.”
[SECTION 5: Logical Programming] Duration: 1-2 minutes
“Last but not least, Logical Programming. Is paradigm mein problems ko solve karne ke liye logical statements use karte hain, jaise if-else
ya rules. Yeh zyada use hota hai AI ya logical problem-solving applications mein.
Example: Prolog
ek example hai logical programming ka, jahan aap facts aur rules define karte hain, aur fir queries run karke answers paate hain.”
[SECTION 6: Differences Between Paradigms] Duration: 1-2 minutes
“Ab aap soch rahe honge ki kaunsa paradigm best hai? Well, sabki apni strengths aur weaknesses hain.
- Procedural Programming: Simple hai, but complex projects mein code maintain karna mushkil ho sakta hai.
- OOP: Reusable code likhne ke liye best hai, par samajhna thoda mushkil ho sakta hai beginners ke liye.
- Functional Programming: Clear aur predictable code deta hai, but shuru mein samajhna thoda confusing ho sakta hai.
- Logical Programming: Logical problem-solving ke liye best hai, but yeh general-purpose programming ke liye itna common nahi hai.”
[SECTION 7: Conclusion] Duration: 1 minute
“Toh guys, aaj humne programming paradigms ko samjha, unke examples dekhe, aur unke differences ko bhi cover kiya. Python aur C++ dono mein code examples se aapko thoda better understanding mili hogi. Agar aapko yeh video pasand aayi ho, toh like zaroor karein, aur agar aapko koi aur topic samajhna hai, toh comments mein batayein. Channel ko subscribe karna na bhoolen, kyunki hum aise hi informative content laate rahenge. Thank you, and see you in the next video!”
[OUTRO in Hinglish] Duration: 10-15 seconds
“Alright dosto, aaj ke liye bas itna hi! Agar aapko yeh video pasand aayi, toh please like karna na bhoolen, aur apne friends ke saath share bhi karein jo programming seekh rahe hain. Aur haan, channel ko subscribe karna na bhoolen taaki aapko har naye video ki update milti rahe. Tab tak ke liye, happy coding, aur milte hain next video mein! Keep learning, keep growing!”