Differences
This shows you the differences between two versions of the page.
— | devwiki:quickdevref [2021/08/28 07:52] (current) – created ying | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Quick Dev Ref page is for quick syntax reference. | ||
+ | |||
+ | ====== Editor Reference ====== | ||
+ | |||
+ | ^ IDE - big | [[appwiki: | ||
+ | | IDE - small \\ cross-platform \\ small \\ sort based by \\ my experience | * [[https:// | ||
+ | | code editor \\ without compiler | vi, vim, [[https:// | ||
+ | | others | [[https:// | ||
+ | | library | [[http:// | ||
+ | ^ Blogs | [[http:// | ||
+ | |||
+ | ====== Procedural type language vs Object-oriented type language ====== | ||
+ | Process-oriented Difference: | ||
+ | * structure definition and operational functions | ||
+ | * like Action + Subject | ||
+ | * class definition and behavior methods | ||
+ | * like Object + Action | ||
+ | |||
+ | Object-oriented characteristics | ||
+ | * Encapsulation | ||
+ | * include properties and methods inside itself | ||
+ | * Inheritance | ||
+ | * Polymorphism | ||
+ | |||
+ | ====== Developing Process ====== | ||
+ | |||
+ | * API vs SDK: http:// | ||
+ | |||
+ | ====== Language Structure ====== | ||
+ | * Syntax - Grammar | ||
+ | * Data type | ||
+ | * data type conversion + user defined | ||
+ | * Logic operation | ||
+ | * Constructor | ||
+ | * statement | ||
+ | * declaration statement : define variables | ||
+ | * type name | ||
+ | * object name | ||
+ | * function name | ||
+ | * expression statement : to assign value | ||
+ | * iteration statement : like a loop | ||
+ | * conditional statement : also known as selection statement | ||
+ | * exception statement : error handling | ||
+ | |||
+ | |||
+ | ====== C++ / cpp ====== | ||
+ | One definition rule : any object can only have one definition. \\ | ||
+ | A variable in C++ is a name for a piece of memory that can be used to store information. | ||
+ | <code cpp> | ||
+ | // defining | ||
+ | class ClassName { | ||
+ | int a; | ||
+ | public: | ||
+ | int b; | ||
+ | int funcA (){ ... } | ||
+ | }; | ||
+ | |||
+ | // function | ||
+ | int main(){ | ||
+ | ClassName objA; | ||
+ | objA.funcA(); | ||
+ | |||
+ | cout << " text here \n"; | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | Data type: bool, char, int, float, double, long double, void, enum \\ | ||
+ | Data structure: pointer, array, reference, structure, class \\ | ||
+ | Scope and Namespace: external, internal, none \\ | ||
+ | Access right: public, private, protected \\ | ||
+ | Constant: <code cpp> | ||
+ | Operation: static cast, dynamic cast, implicit, explicit \\ | ||
+ | Logic operation: ==, <, >, ++, switch(n){case a: act1; | ||
+ | Iteration: < | ||
+ | for ( initial; condition; increment ) { statement } | ||
+ | while ( condition ) { statement } | ||
+ | do{ statement } while ( condition ) | ||
+ | </ | ||
+ | Exception: < | ||
+ | Function (support overloading, | ||
+ | Class: | ||
+ | |||
+ | ====== Objective-C / objc m ====== | ||
+ | | [movie setTitle: | ||
+ | | [movie title]; |=| movie.title; | ||
+ | |||
+ | ====== Java ====== | ||
+ | IO stream | ||
+ | <code java> | ||
+ | System.out.println(" | ||
+ | x = System.in.read(); | ||
+ | </ | ||
+ | |||
+ | Data type: int, short, int, long, float, double, byte, char, string \\ | ||
+ | Data structure: array | ||
+ | Logic operation: ==, !==. <, >, <=, >=, &&, || , ! \\ | ||
+ | Condition statement: | ||
+ | * if(){} | ||
+ | * if(){} else{} | ||
+ | * if(){} else if(){} else{} | ||
+ | * switch(n){case " | ||
+ | Iteration: | ||
+ | * white(condition){} | ||
+ | * do {} while (condition); | ||
+ | * for (int i=0; i < 10; i++){ } | ||
+ | ====== SQL ====== | ||
+ | <code sql> | ||
+ | |||
+ | |||
+ | ====== Language concepts ====== | ||
+ | |||
+ | ===== Passing by Value, Passing by Reference (memory address) ===== | ||
+ | |||
+ | the variable of data type like (int char byte short) is in stack memory; | ||
+ | only passed by value; | ||
+ | |||
+ | the variable of other class objects like (Array ClassName) is in heap memory, and address is in stack memory. | ||
+ | |||
+ | ===== Class ===== | ||
+ | * data [ public , private ] <==> variable <==> member | ||
+ | * function [ public , private ] | ||
+ | * method [ public , private ] | ||
+ | |||
+ | Class can be defined inside another class; nested. | ||
+ | |||
+ | ===== Static ===== | ||
+ | |||
+ | In Class, there is some key feature that never change, like Class Chinese, a property " | ||
+ | |||
+ | So, this kind of property in class never changes in new instances, same as property, method also can be static as that; | ||
+ | |||
+ | Because of " | ||
+ | |||
+ | Its nature: | ||
+ | * all instance shares one copy of the same static property | ||
+ | * Drawback, static method or variable can only access static method and variable; Because non-static stuffs are not there before a instance is created, and key word " | ||
+ | * However, static method and variable can be accessed by anyone | ||
+ | |||
+ | ===== Return ===== | ||
+ | |||
+ | Why there is a " | ||
+ | |||
+ | Simulate real-world procedural, like "Go and buy a bag of super"; | ||
+ | |||
+ | You as main function (home director), The person is a function, and that person once being called, he will return you a bag of super. | ||
+ | |||
+ | if that person made a mistake, then he may return a bag of salt. | ||
+ | |||
+ | so return can be any possible value. | ||