| The topics "Asynchronous Notifications Using Call-Back Methods" and "Asynchronous Notifications Using Events" demonstrate that call-backs are more work to implement than events. However, you should not base your decision about which to use on the amount of work involved. Call-backs and events represent different approaches to communication, and you should select the approach that best fits your needs. | |
| Events | Call backs |
| An event is like an anonymous broadcast | A call-back is like a handshake. |
| The component that raises events knows nothing about its clients | The component that makes call-backs knows a great deal |
| A client that has a reference to an object that raises events can handle those events . The object that raises the events has no information about its clients. It's broadcasting to an unknown audience — perhaps to an empty theater. | By contrast, a component that's making call-backs must have a reference to every object it's going to call. It has to know exactly how many of them there are. |
| An object that raises events has no control over the order in which clients receive its events. (And you should take care to avoid creating dependencies on any ordering you may observe.) | A component making call-backs can control the order in which it calls clients back. It might give some clients higher priority, for example. |
| When an object raises an event, all of its clients handle the event before the object that raised the event gets control again. | a component making call-backs gets control back after each call it makes to a client. |
| If an event contains a ByRef argument, that argument can be altered by any client that handles the event. The last client's changes are the only ones visible to the object that raised the event, because (as noted above) the object that raised the event doesn't get control again until all of its clients have handled the event. | a component making call-backs can examine changes to ByRef arguments after every call to a client, and can pass the next client fresh values for those arguments. |
| If an unhandled error occurs in a client's event handler, the object that raised the event cannot receive the error. If the object is provided by an in-process component running in the client’s address space, both client and component will terminate as a result of the unhandled error. | a component making call-backs will receive errors that occur in the call-back method, and must be prepared to handle them. |
| Events cannot have optional arguments, named arguments, or ParamArray arguments. | Callbacks can have all of these arguments |
| Example - Think of a Server (Employee) and Client (Boss).One Employee can have many Bosses. The Employee Raises the event, when he finishes the task, and the Bosses may decide to listen to the Employee event or not.The employee is the publisher and the bosses are subscriber. | Example - The Boss specifically asked the employee to do a task and at the end of task done, the Boss wants to be notified. The employee will make sure that when the task is done, he notifies only the Boss that requested, not necessary all the Bosses. The employee will not notify the Boss, if the partial job is done. It will be only after all the task is done.Only one boss requested the info, and employee only posted the reply to one boss. |
Tuesday, 16 April 2019
Difference between Callbacks and events in NodeJs
Tuesday, 19 February 2019
One of My Leads
Lead :
My lead is really good
I wanted to make my lead responsible for a change that I have done by marking my lead as a reviewer but lead wanted to make me independent and confident
tried to help me
Even though he is very busy he helped me in getting my doubts clarified
I am the one who will be creating trouble if I didn't work efficiently but
I will be the reason for the team's bad reputation .. I should never do this
I should respect other's time
I should work as a team
I should listen carefully to other's opinions
I need to listen carefully and fully
I need to be very kind and competent
I need to help others
I need to be confident while solving problems.
Thursday, 10 January 2019
Node JS question and answers
1. What is Node.js
Node.js is an open source cross platform JavaScript runtime environment. It runs JavaScript outside of the browser. Node is one of the frameworks of JavaScript. Basically, JavaScript was being used client side where scripts written in JavaScript are embedded into HTML pages and executed client side.
node.js enabled developers to write command line tools and applications thus enabling it to work server side. Hence making JavaScript as a unified programming language for application development
node.js enabled developers to write command line tools and applications thus enabling it to work server side. Hence making JavaScript as a unified programming language for application development
2. Application that receives and processes payments
For payment stripe is used in US. There is node-payments. <I need to study more>
3. CORS
Cross Origin Resource Sharing
Cross Origin Resource Sharing
Subscribe to:
Posts (Atom)