Recently I am learning the ReactJS framework made by Facebook; During the learning process, I have organised 7 important things we need to know when we are learning a new programming language, platform or framework;
Data
First we should learn about how to manipulate the data, here are somethings to learn about data:
- How to define Local, Class or Global Variables
- How to define Constants
- How to use different data types, e.g Integer, String, …
- How to define Structure or Class
- How to deal Data Structure like, Array, Hash, Stack, Set, ..
- How to save or load data from File / Network / Database / Memory / …
- How to convert data from one type to another, e.g String to Number
Example:
var counter = 0;
const MAX_VALUE = 1234567;
Reference:
Output
After we know about Data, we should know how to show those data to us. This is an interesting task;
There are lots of ways to do outputs, here are some of them:
- Showing the data in the system log
- Present the data in the screen
- Present the data by animation (mixing time and data)
- Make the device shaking
- Make some sound;
- Sending Data to server through network;
- Output some signals to make a robot dance; (e.g LEGO MindStorm)
The basic things we should learn about Output are:
- How to show string in console log;
- How to build User Interfaces and display result on it
- How to writing data to file
- – How to send requests to the network (e.g HTTP request)
Example:
console.log(“Hello Javascript console”);
Reference:
Input
In order to interact with the users of the program, we need to learn about the INPUTs;
There are many examples of INPUTs, such as:
- From Joystick and Buttons (e.g Early Video Games)
- From Keyboard and mouse.
- User choices or text from GUI
- Binary or textual data from files
- Visual data from camera (e.g Kinect n is capturing the body figure using camera)
- Touches or Gesture on mobile screen
- Fingerprints
- and more…
The basic things we should learn about Input are:
- How to get inputs from GUI (e.g button, text field, selection box)
- How to get inputs from Device Events (e.g keyboard event, mouse event)
- How to get inputs from File
- How to get inputs from Network (e.g Calling HTTP request)
Example:
<input type=”text” onChange={this.inputChanged}/>
Logic
The above section talked about Input, Output and Data. They are all the essential parts of a program; However, an program cannot do amazing things without Logic. It will be just like a photocopier, bring the data from input and then show it in output, which is not fun.
Things we should learn about Logic are:
- Repeat (for, while) – which is repeat a procedure many time;
Example: convert list of png image to jpeg - Flow control (if-else, switch, continue, break) – do different logic for different condition;
Example: If password is correct, let to enter the system, or else say “Authenication Failed” - Data Conversion – Data conversion is to convert pieces of data from one form to another; Example: converting a PDF document to images, convert objects to texts in order to save;
Module
One of the important technique in problem solving is breaking down a problems in to many smaller problems; In programming, it is similar, our program should be broken into smaller pieces of code, which called “Module”; The language makers usually provides ways for us to make modules;
These are the common forms of the module:
- Function or Method
- Class
- Library or Framework
Things we should learn about Module are:
- How to define those function, method and class;
- How to use them;
- How to build and package a library that can be reused in other projects;
Mechanic
A program is a piece of binary data passed to an executor to perform the actions we want the system do;
If we are writing a simple C program, the mechanic is easy; The system will call the main() function and then follow the logic you defined in your program;
However, if we are writing mobile app like iOS and Android, the system not just calling main(); We are extends a base component provided by the framework; For example, In Android, our program should be extended the Activity class. And the core system will call methods named “start”, “stop”, “resume”, “pause” in different situations; And these are what we need to learn about;
Things we should learn about Mechanic are:
- What is the life-cycle of the language / system you are writing to
- Which methods will be called and when will they being called.
Example:
- ReactJS: https://facebook.github.io/react/docs/component-specs.html
- Android: http://developer.android.com/guide/components/activities.html
Resource
When we learning a new language, you may be not very familiar with it; Therefore, we need to collect different kinds of resource helping us understand the fundamental and tackle different problems during our coding;
The following resources are very useful when learning a language or framework:
- Official Home Page – It usually tells you how to start, tutorial and detail documents;
- Sample Code – Some programmers like me will find source code are more easier to read;
- Documentation – It helps you know more about the module that you are using;
- Tutorial Site – There are many good tutorial sites nowaday; Those site provide tutorials more easier than those from the official one
- Open source projects – There are many good open source projects in GitHub or Google Code which give us hint about how a whole project should be;
- Community – Usually Facebook groups or stackoverflow can give you great supports and help you solve problems;
Finally
To a new language or system well, we should practice by writing more code using that;