- Only one indentation level per method
- Do not
- Wrap primitive types, if they contain behavior
- Only one
-> per line
- Do not abbreviate
- Keep your classes small
- Limit your instance variables to less then 5
- Use ﬁrst class collections
- Use getters and setters
- Document your code
Improve yourself, Write simple code.
copied from Writing code you won’t hate tomorrow
The stack is this chain of suspended function calls, because elements in the stack (function calls) depend on each other.
In a stack of items, items sit one on top of the other in the order they were placed there, and you can only remove the top one (without toppling the whole thing over).
The heap is simply the memory used by programs to store variables. Element of the heap (variables) have no dependencies with each other and can always be accessed randomly at any time.
In a heap, there is no particular order to the way items are placed. You can reach in and remove items in any order because there is no clear ‘top’ item.
source: What and where are the stack and heap? (stackoverflow.com/)
I think of a programming language as a tool to convert a programmer’s mental images into precise operations that a machine can perform. The main idea is to match the user’s intuition as well as possible. There are many kinds of users, and many kinds of application areas, so we need many kinds of languages.
I’ve attempted to organize many of the best ideas that have been discovered related to programming, and to explain them effectively, because I believe computer science is a beautiful body of knowledge.
According to Dr. Axel Rauschmayer‘s blog:
A polyfill, or polyfiller, is a piece of code (or plugin) that provides the technology that you, the developer, expect the browser to provide natively.
A shim is a library that brings a new API to an older environment, using only the means of that environment.
So, a polyfill is a shim for a browser API.
Node.js is very hot now. But just as Ruoyu Sun said, node.js has its own niche.
Only in some specific occations, node.js suits your needs best.
“When you start a new real time web app with not-so-complicated logic, try it.”
In other occations, you should think twice.
“If you are developing an online game, you might want to deal with concurrency more seriously – coroutines might suit you better. If you start a content-centric or CRUD web app, you don’t need Node.js. If you write it with Rails or Django, you can develop much faster and you don’t need to deal with callbacks mess on top of your logic. The thing is, for these apps, you don’t have lots of concurrent requests. And for a single request, most of the time is spent on network transfer and perhaps database query – Node.js does not solve the essential problem here. So instead of squeezing a few milliseconds out of perhaps a hundred, you are way better off getting a SSD or a better bandwidth.”
The suggestion is:
“So only use Node.js when you actually need it. Don’t just use it because it is cool / it is popular/ I heard it’s fast / I want to learn something new.”