Thursday, January 29, 2015

AngularJS Interview Questions

Write a directive

If you have a million records, how do you display on a web page



Q: What is a scope in angularJS?

$scope is the application object (the owner of application variables and functions).
The concept of a scope in Angular is crucial. A scope can be seen as the glue which allows the template, model and controller to work together. Angular uses scopes, along with the information contained in the template, data model, and controller, to keep models and views separate, but in sync. Any changes made to the model are reflected in the view; any changes that occur in the view are reflected in the model.

Q: What is the difference between a service and a factory?

When used within a module, a service function call will return a new value each time it is calls. While a factory function call will return a consistent value each time it is called.


Q: What is bootstrapping?

This code downloads the angular.js script and registers a callback that will be executed by the browser when the containing HTML page is fully downloaded. When the callback is executed, Angular looks for the ngApp directive. If Angular finds the directive, it will bootstrap the application with the root of the application DOM being the element on which the ngApp directive was defined.



Javascript Interview Questions

Question: What are Promises?

Promise is a proxy object for an event that is not necessary yet happened. A success and failure callback functions can be given to a promise, and once the promise is resolved (i.e. the 'promised' event happens successfully) or rejected (the 'promised' event fails), the corresponding callback gets called.
To access an object's promise, the then method is called.

Question: What does setTimeOut() do?

  • setTimeout() - executes a function, once, after waiting a specified number of milliseconds

Question: What is closure?

This will always alert 16, because bar can access the x which was defined as an argument to foo, and it can also access tmp from foo.
That is a closure. A function doesn't have to return in order to be called a closure. Simply accessing variables outside of your immediate lexical scope creates a closure.


Question: Write a function that combines two arrays into one?


Q: What is a callback? Callbacks are a more traditional way of handling asynchronous execution in JavaScript. A callback is a function that is passed to another function as a parameter, and the execution of the callback happens inside the function that it was passed to.


How data is persisted

OMG! Please start using MongoDB now! It is fun and easy to use. But hard to troubleshoot once the level of complexity of your data grows. Keep it simple! KISS

How the web works

Another place holder blog entry. There are a bunch of great articles that discuss performance on the web and other networks. The information if always changing. So I hope to post the most relevant links I can find.

In my humble opinion (IMHO) I believe the best way to track such information is to track people. Google has the brightest and nicest folks who share that information:

Ilya Grigorik

https://www.igvita.com/

Matias Niemela

algorithms

Another placeholder blog post. Khan Academy is a great site for learning algorithms: https://www.khanacademy.org/computing/computer-science/algorithms

During the study of such things, it'll be good to have working examples of their implementations to do actual useful things. Things that actually provide return on investment (ROI) for companies. Remember that if you have a programming job, the company you are working for is really spending 4 times more than that on infrastructure to have what you're writing actually be used for your companies customers.

Data Structures

This is a placeholder for data structures. You know data structures! Oh wait! You may want to know the type of interview questions that are often asked regarding them. Knowing something, and the ability to actually communicate what you know in a job interview are two different things. Googling data structure interview questions is a good first step. But to be ready for interviewing, you'll need to think about the Q and A provided on interview question websites.

core java

What is core java? Well, basically all the javadoc for JDK 1.6, 1.7, and now 1.8. Need to learn a large majority of the classes documented. As well as the difference between versions 1.6 to 1.8. Right now most companies are bound to one of those 3 versions. And so if you want to work for a company that is using one of these JVMs, you need to have a lot of the fundamentals mesmerized.

For Example, java.lang.Object, which has the basic methods used for creating your own collections. These need to be understood and how to overwrite them.

Also, need to know Collections class and all of its implementations. When you would want to use one over the other, etc.

Also sorting algorithms, you should know how to write binarysort, bubblesort, and mergesort on a whiteboard really fast. I suggest practicing it in the evening, a couple of days before an interview.



Java to Javascript

I have a been a java developer for over 10 years. Which I think is 3 life times in silicon valley. During that time I have worked on J2EE, EJB 1, 2, and 3. Spring Frameworks. Struts 1.0, 2.0. JSP. JMS. JMX, etc. etc. All the acronyms at some point.

At the beginning of 2015 I found that there are still a lot of java positions. Many of which want people with core java skills. Those skills are tied to:


If you know these 5 things, you can get any java programming job. And I think someone graduating from college that has actually learned what was in the classes taught by computer science departments, should do just fine. BUT! And there is a big BUT, actually having the knowledge, and being able to communicate that knowledge to an interviewer at Google is something different. 

practice, practice, practice

The interview books that have 100’s of java examples is amazing. They really help. Also the new websites that teach you programming skills and have test areas on their sites is also very good.

javascript

Now knowing java, and knowing javascript I consider two totally different beasts. There is very little ‘java’ in javascript. The runtime environments are very different. The life cycle of objects in client and server are different. They have different design patterns. They have different ways of implementing OOAD, etc. From someone who has been paid for 10 years to write java, switching to javascript has a learning curve. Many enterprise developers may feel that it is a waste since only a small amount of code is being used.

But with node.js and angularJS becoming performant and fully supported by Google. You can have all your usual enterprise stack re-written using NoSQL (MongoDB), nodes, and AngularJS at the front end. And now with complete packaging such as meteor. You can go enter the next hackathon and kick ass over others attempting to use Spring boot, etc.







Wednesday, January 21, 2015

Stay Hungry

Humble, Honest, Happy, and Hungry! 4H!

Here are some sites I been using that really help with learning specific technologies.

This site is great for answering questions regarding technologies I use at work:
http://www.stackoverflow.com

Great for posting code that I've been working on:
http://www.github.com

Great site for getting some code time under your belt:
https://www.hackerrank.com/domains/algorithms/arrays-and-sorting