devwiki:quickdevref

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:xcode|Xcode]], [[https://www.visualstudio.com/products/visual-studio-community-vs|Visual Studio Community edition]] (replaced VS Express), [[http://www.eclipse.org/downloads/packages/|eclipse]], [[http://netbeans.org/|NetBean]] |
 +| IDE - small \\ cross-platform \\ small \\ sort based by \\ my experience | * [[https://www.qt.io/download-open-source/|Qt Creator]] \\ * [[http://codelite.org/|CodeLite IDE]] \\ * [[http://www.bloodshed.net/devcpp.html|Bloodshed Dev-C++ (old)]] ([[https://sourceforge.net/projects/orwelldevcpp/|SF new]]) \\ * [[http://www.codeblocks.org/|Code Blocks]] ([[https://sourceforge.net/projects/codeblocks/|SF link]]) \\ * [[http://www.ultimatepp.org/|Ultimate++]] |
 +| code editor \\ without compiler | vi, vim, [[https://notepad-plus-plus.org/|Notepad++]], [[https://www.sublimetext.com/|sublime text]], [[https://atom.io/|Atom]], [[https://code.visualstudio.com|VisualStudio Code]] |
 +| others | [[https://www.jetbrains.com/webstorm/|WebStorm-JS IDE]], [[https://www.jetbrains.com/idea/|IntelliJ IDEA - Java, Web]] |
 +| library | [[http://www.boost.org/|Boost]], Qt,  ref: [[http://stackoverflow.com/questions/2702416/portable-c-ide|link]]  |
 +^ Blogs | [[http://technofreaky.wordpress.com/|PHP & Linux]], [[http://sree.cc/|Android]] |
 +
 +====== 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://stackoverflow.com/questions/834763/api-vs-sdk
 +
 +====== 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(); // do method
 +
 + cout << " text here \n";
 +
 + return 0;
 +}
 +</code>
 +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>const int a=0; //constant can not be changed</code>
 +Operation: static cast, dynamic cast, implicit, explicit \\
 +Logic operation: ==, <, >, ++, switch(n){case a: act1;break;}, break, continue, return, goto \\
 +Iteration: <code>
 +for ( initial; condition; increment ) { statement }
 +while ( condition ) { statement }
 +do{ statement }  while ( condition )
 +</code>
 +Exception: <code>try{statement; on error, throw variable;} catch(variable){statement;}</code>
 +Function (support overloading, virtual): void func1 (int x, int y){} \\
 +Class: 
 +
 +====== Objective-C / objc m ======
 +| [movie setTitle:@"Iron man"]; |=| movie.title = @"Iron man"; |
 +| [movie title]; |=| movie.title; |
 +
 +====== Java ======
 +IO stream
 +<code java>
 +System.out.println("Hello!");
 +x = System.in.read();
 +</code>
 +
 +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 "val1": stt; break;}
 +Iteration:
 +  * white(condition){}
 +  * do {} while (condition);
 +  * for (int i=0; i < 10; i++){ }
 +====== SQL ======
 +<code sql>DELETE FROM `databaseName`.`tableName` WHERE `databaseName`.`tableName` = 'theValue'</code>
 +
 +
 +====== 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 "nationality" is always "chinese";
 +
 +So, this kind of property in class never changes in new instances, same as property, method also can be static as that;
 +
 +Because of "static" nature, the property and method is pre-built and can not have individual value for each instance, therefore, even there is no instance of a class, the property and method can be directly used even without any instance created.
 +
 +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 "this" also can not by used by static stuffs
 +  * However, static method and variable can be accessed by anyone
 +
 +===== Return =====
 +
 +Why there is a "return" value
 +
 +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.