Sunday 14 February 2016

Lecture#2 ka Point#68 (Csharp Roman Hindi/Urdu Me).

Jab bhi hum koi program bnatey hain to sab se pehley us program ka sketch bnatey hain ya logic design krtey hain k humare program me kon konsi data types use hongi.

Jo fields hum in the form of table save kr rhey hotey hain to sab se pehla sawal yeh zehn me ata hai k "What is table?". Table humare pass aik "Entity" hai. Jab bhi hum data type ki baat kr rhey honge to iska matlab yeh hai k hum "Entity" ki baat kr rhey honge.

"Entity" basically represent krti hai data type ko ya data type represent krti hai "Entity" ko. For Example: Hum aik school system bna rhey hain to school system ko mad-e-nazar rakhtey huvey humare zehn me kya kya cheezey ati hain, woh humari "Entity" kehlaye gi (LIKE: Student, Teacher etc). "Student" humare pass "Entity" hogi aur "Student" k umbrella k under (Student name, Roll number, Fees, Course, Class etc) hoga. Humey yahan se aik data type identify hui jis ka naam "Student" hai. "Teacher" bhi humare pass aik "Entity" ya data type hai aur (Teacher name, salery etc) "Teacher" ki properties hongi.

Jesey hum baat krtey hain (byte, short, integer aur long data types etc) ki to in ki jo characteristics hain woh aik dafa define kr di gai hain k (byte, short, integer aur long data types) kis tarha ki hongi bilkul isi tarha "Abstract data type" me hoga k hum aik dafa data type ki jo characteristics define kren ge woh change nahi hongi.

Ab Jesey humney "Student" aur "Teacher" k naam ki 2 different "Abstract data types" banai ya "Entities" bnai. To "Student" aur "Teacher" ko jo cards miley hon ge (school ya college ya university) ki taraf se un me differnce hoga. Jesey "Student" k card me (Form#, Reciept#, Name, Course, Roll#, Valid upto etc) jesi properties ya attribute ya fields hongi. Ab "Student" k card me ye Jo 6 fields ya variables ya place holders hain yeh kisi na kisi data type ko represent kr rhey hon ge lakin yeh tamam fields mil kr aik "Entity" bnaye gi jo "Student" hogi Aur tamam "Students" k pass jo card hongey un pr yehi properties ya fields ya attributes hongey. Aesa nai ho sakta k kisi "Student" k pass in me se koi aik field ya property na ho ya phir aik field ya property zyada ho. Tamam "Students" ki yeh 6 properties ya variables hongey jo tamam "Students" me same hongey. Humare pass "Teacher" next "Abstract data type" hai aur "Teacher" ki data type "Student" ki data type se change hogi.

"Student" humare pass data type hogi lakin school ki class me mojood tamam students "Instance" ya "Object" kehlaye ge "Student data type" ka. "Instance" is basically a representation of that data type.

Ab jesey "salery" humare pass aik property hai. "Salery" to "Teacher" ko milti hai jab k "Student" fees pay krta hai.Jab aap "Entities" ko ya "Abstract data types" ko identify kren ge to unki "Properties" ko bhi identify kren ge.

Jab hum "Abstract data type"(user defined data type) ki baat krte hain to iska matlab hai k hum "Class" ki baat kr rhey hain. "Class" k ilawa bhi hum apni "Abstract data type" ko define kr saktey hain. "Class" is basically an "Entity". Jesey hi hum "Entity" ki baat kre ge to humey us "Entity" ki properties aur behaviors samajh ana shuru ho jayen ge. Jesey "Teacher class" ka behavior perhana hoga. "Class" ki properties noun hongi aur behaviors verb hon ge. "Properties" ko hum "Attributes" bhi kehtey hain.

Example#1: "Men" aur "Women" humarey pass 2 different "Classes" mojood hain aur in dono classes k different behaviors aur different properties hon gi. "Men" aur "Women" classes ya data types sirf aik dafa define ki gai hon gi. Ab jitney bhi "Men" aur "Women" hongey woh in classes ya data types k "Instance" hongey.

Example#2: "Laptop" class me laptop ki properties aur behaviors ko sirf aik dafa define kiya gya hoga. Laptop bnaney wali company ka aik assembling plant hoga jis me aik dafa define kiya gya hoga k is laptop ka model, color, memory, hard disk, RAM, proccesor etc kis tarha k hoga. Ab jitney bhi laptop is assembling plant me manufacture hon ge woh sab same hon ge. Tamam laptops jo is assembling plant se manufacture ho k nikley ge woh "Laptop data type" ya "Laptop class" ka "Instance" kehlaye ge.

Agar hum aesi "Class(data type)" bnatey hain jis ka koi "behavior" ya "property" na ho to us se humara koi objective achieve nahi hoga.

Sunday 7 February 2016

Lecture#2 ka Point#67 (Csharp Roman Hindi/Urdu Me).

Abstract Data Type:-

"Abstract data type" ka matlab hai, "user defined data types".

Jo users khud apni data types bnaye ge usey hum "Abstract data type" kehtey hain. Hum apni requirement k hisab se data type define kre ge.

Hum C# ME Images, Audios, Videos etc ko store krwane k liye "Primitive data types" use nahi kr saktey kyun k "primitive data types" me koi aesi data type nahi jo humari requirement ko fulfill krti ho to is k liye hum "Abstract data type" bnatey hain.

Image, audio, video, date, time etc ko hum "primitive data type" k saath store nahi krwa saktey.

Friday 5 February 2016

Lecture#2 ka Point#66 (Csharp Roman Hindi/Urdu Me).

Visual studio(.NET Framework) coding me humey boht help kr rha hota hai. Visual studio ki apni intelligence hai. Jisey hum snippets kehtey hain.

Visual studio aik "single integrated development environment" hai. Visual studio me 5 compilers by-default hotey hain jab k 30+ compilers extend hotey hain aur yeh tamam development tools and technologies aap single IDE me integrate kr saktey hain.

Visual studio me hum takriban tamam types ki applications bna saktey hain in all the programming languages.

Lecture#1 ka Point#65 (Csharp Roman Hindi/Urdu Me).

Humare pass Csharp(.NET Framework) me 2 types k error hotey hain.

  1. Compile time error
  2. Run time error

"Compile time error" me compiler error ko judge kr leta hai aur humare program ko wahin rok deta hai aur humey error message show kr deta hai.

"Run time error" woh hotey hain jo logical reasons ki wajah se aatey hain.


Example Code#1:
1 short s = 256;
2 byte b = (byte) s;
3 Console.WriteLine(b);
4 Console.ReadLine();
OUTPUT: 0

Example Code#2:
1 short s = 257;
2 byte b = (byte) s;
3 Console.WriteLine(b);
4 Console.ReadLine();
OUTPUT: 1
(kyun k byte data type ki maximum range: "255" hai.agar byte data type ki value 255 se barh jaye gi to woh apni minimum range: "0" se value ko dobara start kr de ga.)

Wednesday 3 February 2016

Lecture#1 ka Point#64 (Csharp Roman Hindi/Urdu Me).

Aik default behavior hai C#(.NET Framework) me type casting ka k jab hum choti se bari data type me move kr rhey hotey hain to value ko hum easily choti se bari data type k saath store kr saktey hain.

For Example:

Byte data type ki value ko agar hum short data type me store krwaye to woh easily store ho jaye gi. Is me type casting hogi aur value easily convert ho jaye gi aur humey value lost ho janey ka bhi khof nahi hoga. Isko hum "Implicit type casting" kehtey hain, jis me hum value choti data type se bari data type me convert kr rhey hotey hain.

"Implicit type casting" me agar hum type casting nahi krtey to C#(.NET Framework) ka default behavior hai k woh khud hi type casting kre ga. "Implicit type casting" ko hum "Boxing" bhi kehtey hain.

"Explicit type casting" ya "unboxing" jo hai "Implicit type casting" ya "boxing" ka ulat hogi bas farq(difference) sirf itna hoga k "implicit type casting" me type casting optional hogi jab k "explicit type casting" me type casting required ya mandatory hogi.

"Explicit type casting" me values lost honay ka chance hota hai.

For Example:

Agar humey aik barey(big) box ko chotey(small) box me daalna ho to big box kaat peet kr ya tor maror kr small box me chala to jaye ga lakin us big box ki original shape lost ho jaye gi.

Implicit Type casting with example code:
1 byte b = 100;
2 short s = (short) b;
3 Console.WriteLine(s);
4 Console.ReadLine();
Output: 100

Explicit Type casting with example code:
1 short s = 100;
2 // byte b = s; //error aa jaye ga.
3 byte b = (byte) s;
4 Console.WriteLine(b);
5 Console.ReadLine();
Output: 100

TIP: Acha programmer woh hota hai jo "explicit type casting" ho ya phir "implicit type casting", woh "explicit type casting" hi krta hai.

Monday 1 February 2016

Lecture#1 ka Point#63 (Csharp Roman Hindi/Urdu Me).

Type Casting:-

Aik data type ko doosri data type me convert krne ko hum type casting kehtey hain.

Aik game hai jis me aik box hota hai aur jab hum us box ko kholtey hain to us k ander aik chota box hota hai aur is chotey box k andar aik aur is se bhi chota box hota hai aur is tarha krtey krtey aakhir me aik machis ki dabi(match box) nikalti hai aur is machis ki dabi me tofi ya coin rakha hua hota hai, bilkul isi tarha type casting me hum size k hisab se bari data type ko choti data type me convert kr rhey hotey hain, is Phenomenon ko hum unboxing kehtey hain.

Paragraph#2 me di gai box wali example ko mad-e-nazar rakhtey huwey hum long data type me se interger data type nikaltey hain aur phir integer data type me se short data type nikaltey hain aur akhir me short data type me se byte data type nikaltey hain, agar humari desired value byte data type me hogi. Is Phenomenon ko hum boxing aur unboxing kehtey hain. Boxing aur unboxing k liye humey type casting ki zaroorat perhti hai.

Boxing aur unboxing me type cast krtey waqt agar long data type se byte data type me convert krna hai to humey koi zaroorat nai k pehley hum long data type ko integer data type, phir integer data type ko short data type aur phir akhir me short data type ko byte data type me cast kre, balkey hum C# me direct long data type ko byte data type me cast kre ge.