Pages

Wednesday 19 February 2014

Can Software Developers enjoy their personal life?

Can Software Developers enjoy their personal life?

Normally in any job around the world, you have to work for 40-45 hours a week. But is this really true for a software developer? As a software developer, if you have to grow in your professional life, you have to sacrifice your personal life. This statement is intimidating, but true to some extent. Mainly, the initial years of a software developer are very crucial and you have to work extensively to thrive in your career. Only the lucky software developers get flexible working hours in the office otherwise most of the software developers have to compromise their personal life.

In a software industry, you will have to face:

1. Tight Deadlines
2. Excessive Work Load
3. Staying Late Nights
4. Working on Weekends
5. Code quality and code delivery at same time
6. Bug fixing

If you are a software developer, you have to try hard to maintain work-life balance. Software development is full of uncertainties. Any time any thing can happen in your project and then you have to sit to solve that issue. You always have to think twice before planning your evenings, weekends and holidays as these uncertain and untimely issues can destroy them easily. If you are planning to go for a long holiday, you will have to plan that according to the situation in the project. If you are running through a lot of issues, forget that you will get leaves. You have to inform your manager months ago for your holiday plans otherwise just forget it.

Single vs Married vs Parent Developers

If you are still single, that's fine. You can stay late evenings, you can come on weekends etc. You can also take excessive work load and pressure because at this stage of life you don't have to care about other troubles of your life (except your girlfriend, if you have :) ) as your personal life is smooth till now. But once you get married, you get extra personal life responsibilities on your shoulder. Now you also have to care about your life partner. You also have to give sufficient amount of your time to her/him. You cannot come stay late in office every evening, cannot come to office every weekend etc. etc. The situation becomes worst after kids. At this stage of life, you really have to struggle hard to maintain work life balance otherwise you will not be able to see your kids growing.

Advice to software developers:

1. It depends on how you handle the situation and your skill. However, to survive in the any kind of stream, you should invest your time for atleast 2 to 3 years in that domain and understand clearly. Then you will go into a better position in that stream and you can do well with balanced life. I mean, after you understand clearly about what you do, then only you can prioritize the work properly and can live balanced life with work and family. There are lot of companies which expects only 40 hours of work. Even there, if you fail to deliver, you should put more time and complete the work.

2. Companies take advantage of eager graduates and workaholic tendencies. Just refuse to fall into the pressure to extend hours. If companies can't deal with that, then your better off looking for a new employer. When interviewing at new jobs, it would be good to find out what their overtime policies are. If they have real overtime policies that involve giving you respectable amounts of money for working late, they're probably not as likely to ask for 60-hour work weeks (though I would try to talk to other employees there to get an idea of what actually goes on).

3. Product companies have better working hours compared to Service Oriented companies. So try to get into product companies. But product companies are limited as compared to software oriented companies. 

Sunday 16 February 2014

Tips to make Interview comfortable for Interviewee

Tips to make Interview comfortable for Interviewee

Job interviews can be intimidating and uncomfortable for applicants. People enter an interview unsure of what is expected and nervous about their performance. The more you, as the employer, can do to make the experience less stressful, the more accurate your impression will be of the person you're interviewing.

Some HR personnel may make candidates feel nervous, unintentionally. However, most HR staff want prospects to feel welcome and at home. It’s important to remember that your company is being interviewed too. People are becoming more and more selective about the jobs they’ll accept these days as a result. Therefore, here are a few simple things you can do that will help job candidates feel much more comfortable before, during and after the interview process. 

1. Have someone to greet the candidate personally

No matter how busy things are, you need to make a point of having someone ready to make the candidate feel welcomed by the company. You do have a position that needs to be filled and the only way that’s really going to happen for any significant amount of time is if you find someone that really wants to be there. Welcoming a candidate is a simple gesture that will help the candidate decide whether or not this is the right job for his or her needs.

2. Make introductions 

Don’t leave the candidate wondering who everyone in the room is while everyone in the room knows who he or she is. It makes for an uncomfortable situation for the job seeker and one that may ultimately be a turn-off to the candidate and his or her interest in your company.

3. Give the candidate a chance to warm up to you and the situation rather than diving right into the heart of the interview process

There are benefits to small talk that go far beyond ascertaining a little bit about how the other person thinks. It helps put people at ease and makes the interview much more productive on all sides. It also lets the candidate see that there are real, genuine people on the other side of the hiring equation. Don’t skip this important part of the process. 

4. Explain the interview process so the candidate knows what to expect

This will make your candidate feel much more at ease and help you feel more comfortable as well. But it also gives the candidate a moment or two to map out how he or she is going to approach the interview questions, and how to follow up.

5. Allow the candidate time to fully articulate his ideas and thoughts, and invite follow-up questions

If the candidate feels rushed through the interview he may feel as though the job is already lost. More importantly, he may feel that the powers that be within the company aren’t really interested in listening to what he has to say. Give the candidate your business card and invite him to contact you with any additional questions or concerns.

6. Treat it Seriously

When you arrive late to an interview, the interviewee may take it as a sign that she is not that important to you. When you make sure to arrive on time and with a welcoming demeanor, she will feel significant and respected. Instead of getting straight to business when the interview begins, attempt to break the ice with small talk about something you think may appeal to the applicant. By taking the first step toward getting to know your interviewee, you take the pressure off someone who is probably already stressed to the limit with anticipation. Once an easy rapport has been developed, she may perform better once you do get down to more serious topics.

7. Line of Questioning

When asking interview questions, use a positive and supportive tone. The idea is to draw the best response as possible from your subject and not to make her uncomfortable or defensive in any way. For example, ask simpler questions at the start of the interview so the subject has a chance to establish herself and become more confident before moving on to more complex or difficult questions. Avoid long and confusing hypothetical situations, accusatory questions or questions with a negative slant. To elicit strong and honest answers, try to keep things positive and allow sufficient time for the interviewee to develop her thoughts, even if the answers you're getting are not what you want to hear.

8. Personal Touches

Have an employee meet and greet each candidate who arrives for an interview. Introduce them to the people they will be working with and anyone they run into while at the office. A basic tour of the office and a walk around the premises is another way to show each person that they are being seriously considered as a potential hire. Walking into a strange place filled with strange people can be intimidating, especially when you will soon have to answer a barrage of questions that determine your future. A simple and warm introduction can take the edge off and make the rest of the process much easier to handle.

9. Before and After

Tell the candidate what to expect before beginning. There's no need to keep the interviewee wondering what to expect. Instead, tell her the basic idea of the interview process, what the questions will focus on and what you hope to learn. Once the interview is concluded, explain to her what she should do next and where she stands. Honesty can remove much of the mystery that often surrounds job interviews while erasing the nervousness that comes along with uncertainty. Try not to dismiss candidates from behind your desk. Instead, walk out with them so they leave with a positive feeling.

Saturday 15 February 2014

With Keyword in Delphi

With Keyword in Delphi

The With keyword is a convenience provided by Delphi for referencing elements of a complex variable, such as a record or object. 

It simplifies the code by removing the need to prefix each referenced element with the complex variable name. 

For example: 

myObject.colour := clRed;
myObject.size   := 23.5;
myObject.name   := 'Fred'; 

can be rewritten : 

With myObject do
begin
  colour := clRed;
  size   := 23.5;
  name   := 'Fred';
end; 

However be warned that it can surprisingly make your code more difficult to read, especially when nesting With clauses. More disturbingly, it can create maintenance problems, where a code change can mean that the wrong target for the 'child' field referenced.

Example code: Using the with keyword with a record structure

type
  // Declare a customer record
  TCustomer = Record
    firstName : string[20];
    lastName  : string[20];
    address1  : string[100];
    address2  : string[100];
    address3  : string[100];
    city      : string[20];
    postCode  : string[8];
  end;

var
  John, Sarah : TCustomer;

begin
  // Set up the John's customer details
  With John do
  begin
    firstName := 'John';
    lastName  := 'Smith';
    address1  := '7 Park Drive';
    address2  := 'Branston';
    address3  := 'Grimworth';
    city      := 'Banmore';
    postCode  := 'BNM 1AB';
  end;

  // Set up John's sister similarly - simply copying the whole record
  Sarah := John;

  // And then changing the first name to suit
  Sarah.firstName := 'Sarah';

  // Now show the details of both customers
  With John do ShowCustomer([firstName, lastName,
                             address1, address2, address3, city,
                             postCode]);
  With Sarah do ShowCustomer([firstName, lastName,
                             address1, address2, address3, city,
                             postCode]);
end;

// A procedure that displays a variable number of strings
procedure TForm1.ShowCustomer(const fields: array of string);
var
  i : Integer;

begin
  // Display all fields passed - note : arrays start at 0
  for i := 0 to Length(fields)-1 do
    ShowMessage(fields[i]);
end;

Output

John
Smith
7 Park Drive
Branston
Grimworth
Banmore
BNM 1AB

Sarah
Smith
7 Park Drive
Branston
Grimworth
Banmore
BNM 1AB

Pointers in Delphi

Pointers in Delphi

Pointers are a special type of variable. Like a meta-variable. They can point to other variables, or to memory. You might use a record pointer, for example, to point to a block of memory where you have stored lots of record data. You would then use the pointer just as if it were a record variable. The Pointer type provides a general use pointer to any memory based variable. That is, one that is accessed by reference. 

Delphi provides a number of typed pointer types, such as PChar, and PExtended, along with a generic, 'point to anything' type - the Pointer type.

var
  generalPtr : Pointer;  // A pointer to anything
  formPtr    : ^TForm;   // A pointer to a form object

begin
  // The current unit's form is addressable via the self keyword
  generalPtr := Addr(self);

  // We can assign this pointer to the form pointer
  formPtr := generalPtr;

  // And set the form caption to show this
  formPtr.Caption := 'Test program';
end;

The nice thing about the typed pointers is that they work sensibly with the Inc and Dec functions. Incrementing an PInt64 pointer will add SizeOf(Int64) bytes to the pointer address so that it points to the next Int64 variable in memory.
 
The Pointer type is a dangerous one - it falls foul of Delphi's normally tight type handling. Use it with care, or you will end up addressing the wrong memory. It is normally always better to use a specific pointer reference to the data type you are using.

Different Pointer types in Delphi

PAnsiChar: A pointer to an AnsiChar value
PAnsiString: Pointer to an AnsiString value
PChar: A pointer to an Char value
PCurrency: Pointer to a Currency value
PDateTime: Pointer to a TDateTime value
PExtended: Pointer to a Extended floating point value
PInt64: Pointer to an Int64 value
PShortString: A pointer to an ShortString value
PString: Pointer to a String value
PVariant: Pointer to a Variant value
PWideChar: Pointer to a WideChar
PWideString: Pointer to a WideString value

A simple example using PChar

The PChar type can be used to scan along a string :
 
 var
   myString  : string;
   myCharPtr : PChar;
   i : Integer;

 begin
   // Create a string of Char's
   myString  := 'Hello World';

   // Point to the first character in the string
   i := 1;
   myCharPtr := Addr(myString[i]);

   // Display all characters in the string
   while i <= Length(myString) do
   begin
     ShowMessage(myCharPtr^);  // Display the string characters one by one
     Inc(i);
     Inc(myCharPtr);
   end;
 end;

There are two things to note here. First the use of Addr function to get the address of the string. You could equally use the @ operator. Pointers always work with addresses - the address of a variable here, or a block of acquired memory. Here we point the PChar value to the first character in the string.
 
Secondly, now that we have a pointer, we use the ^ character at the end of the pointer name to refer to what the pointer points to. In this case, a character.
 
A PChar^ will always give us a character. A PInt64^, for example, will give us an Int64 value. This is where the typing comes in.

Record pointers

You can define a pointer to any data type using a different technique:
 
 var
   myRecordPtr : ^TMyRecord;

Here, the ^ symbol is used to dereference the type - we are saying that we do not have a TMyRecord type, but a pointer to one. Note that this is a prefix use of ^.
 
Let us create a full record example :
 
 type
   TMyRecord = Record
     name : String[20];
     age  : Integer;
   end;

 var
   myRecord    : TMyRecord;
   myRecordPtr : ^TMyRecord;

 begin
   myRecord.name := 'Fred Bloggs';
   myRecord.age  := 23;

   myRecordPtr := @myRecord;

   ShowMessage(myRecordptr.name);  // Displays 'Fred Bloggs'
 end;

When we simply refer to the record field name, without a ^, Delphi is in fact adding one for us - it recognises what we are doing, and helps us make for more readable code.

Currency Data Type in Delphi

Currency Data Type in Delphi

Currency is a fixed-point data type that minimizes rounding errors in monetary calculations. It is stored as a scaled 64-bit integer with the 4 least significant digits implicitly representing decimal places. When mixed with other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.

The Currency type is designed for use in financial applications. It supports 4 decimal places with at least 53 bits precision. Decimal places beyond the supported 4 are rounded up or down, as appropriate. See the sample code for an example.

var
  account1, account2, account3 : Currency;
begin
  account1 := 123.456749;   // Too many decimals - will be rounded down
  account2 := 123.456750;   // Too many decimals - will be rounded up
  account3 := account1 + account2;

  ShowMessage('Account1 = '+CurrToStr(account1));
  ShowMessage('Account2 = '+CurrToStr(account2));
  ShowMessage('Account3 = '+CurrToStr(account3));
end;

Output

Account1 = 123.4567
Account2 = 123.4568
Account3 = 246.9135

Tuesday 11 February 2014

Conditional Compilation in Delphi

Conditional Compilation in Delphi

Conditional compilation is based on the existence and evaluation of constants, the status of compiler switches, and the definition of conditional symbols.

Conditional symbols work like Boolean variables: they are either defined (true) or undefined (false). Any valid conditional symbol is treated as false until it has been defined. The {$DEFINE} directive sets a specified symbol to true, and the {$UNDEF} directive sets it to false. You can also define a conditional symbol by using the -D switch with the command-line compiler or by adding the symbol to the Conditional Defines field on the Project > Options > Delphi Compiler page.

The conditional directives {$IFDEF}, {$IFNDEF}, {$IF}, {$ELSEIF}, {$ELSE}, {$ENDIF}, and {$IFEND} allow you to compile or suppress code based on the status of a conditional symbol. {$IF} and {$ELSEIF} allow you to base conditional compilation on declared Delphi identifiers. {$IFOPT} compiles or suppresses code depending on whether a specified compiler switch is enabled.

For example, the following Delphi code snippet processes differently depending on whether the DEBUG conditional define is set. You can set conditional defines on the Project > Options > Delphi Compiler page or by entering {$DEFINE DEBUG} in your code:

{$DEFINE DEBUG}
{$IFDEF DEBUG}
  Writeln('Debug is on.');  // This code executes.
{$ELSE}
  Writeln('Debug is off.');  // This code does not execute.
{$ENDIF}

{$UNDEF DEBUG}
{$IFNDEF DEBUG}
  Writeln('Debug is off.');  // This code executes.
{$ENDIF}

Note: Conditional symbols are not Delphi identifiers and cannot be referenced in actual program code. Similarly, Delphi identifiers cannot be referenced in any conditional directives other than {$IF} and {$ELSEIF}.

Note: Conditional definitions are evaluated only when source code is recompiled. If you change a conditional symbol's status and then rebuild a project, source code in unchanged units may not be recompiled. Use Project > Build All Projects to ensure that everything in your project reflects the current status of conditional symbols.

Monday 10 February 2014

How to open and close datasets in Delphi? Difference between Open Method and Active Property in Delphi

How to open and close datasets in Delphi? Difference between Open Method and Active Property in Delphi

To read or write data in a dataset in Delphi, an application must first open it. You can open a dataset in two ways:

1. Open method: Call the Open method for the dataset at run time.
2. Active Property: Set the Active property of the dataset to True, either at design time in the Object Inspector, or in code at run time.

After performing operations on datasets, you must close them. You can close a dataset in two ways:

1. Close method: Call the Close method for the dataset at run time.
2. Active Property: Set the Active property of the dataset to False, either at design time in the Object Inspector, or in code at run time.

For example, if you have dsSample dataset in your code. You can open it like:

dsSample.Open;
dsSample.Active := True;

and close it like:

dsSample.Close;
dsSample.Active := False;

Difference between Open and Active

1. Open is a methods and Active is a property.

2. Open method is generally used at runtime while Active property is used to open dataset at design time. Active deals with Object Inspector. Without having Active property you wouldn't be able to open the dataset at design time because you cannot publish method to the Object Inspector.

3. Open method is much more readable than evaluating what's assigned to the Active property.

4. Active property calls Open method internally.

5 Advantages and Disadvantages of Software Developer Job

5 Advantages and Disadvantages of Software Developer Job 

No job is perfect. Every job has some advantages and disadvantages. If you are enjoying your job, that job is best for you. You should carefully choose a right career for you as it can make your life heaven or hell. If you have chosen for becoming a software developer, you must know the pros and cons of this career. I would like to share the advantages and disadvantages of software developer's job.

Advantages of Software Programming Job

1. Good Pay: As compared to other jobs and professions, software programming job's pay is high.

2. Portable Skills: You learn a lot of things like programming language, software tools etc. in one company and can apply that knowledge in another company. When you switch from one company to another, you also get a good salary hike.

3. Work Anywhere: You can work from anywhere. All you need is one laptop and the internet connection. Work From Home is a very good facility in this field.

4. Comfortable Working Environment: You work in a very comfortable environment. You always have access to fast internet connection. You always have air condition office, nice comfortable chair. You don't have to worry about the harsh weather conditions outside. Heavy rainfall, hailstorm, cold snow, hot or cold weather cannot affect your work.

5. Continuous Learning Curve in all directions: You always keep on learning new things in your office, in your project. Your knowledge continuosly increases with your experience. You always remain updated with the new technologies and inventions.

Disadvantages of Software Programming Job

1. Global Competition and Outsourcing: We live in a very well connected world. Every body in any corner of the world is well connected with each other through emails, messengers etc. There is great IT workforce in India which can do the same job in less money as compared to the developers in USA and Europe. Almost every IT company outsources its lot of work to India to reap benefits by utilising the talent of India and saves a lot of money. So, the competition in this field is global and you have to be very perfect to cope this.

2. You have to upgrade your skills continuously: Technology is changing every day. Everyday, there are new enhancements, everyday there is new invention. You have to keep yourself very active and updated otherwise you will be left behind in the race. You have to learn new thing everyday. You should learn to adapt with new things. Standing rigid with the old things will make you lose the competition. Keep on learning new programming languages and always add new thing to your resume.

3. Sitting Job: You have to sit tight to your desk and stare at your computer continuously. If this is not fine for you, you should not come to this profession. But today, other jobs are also becoming like this. So you will find this kind of scenario in each and every job. It can make you unhealthy very easily.

4. Age Discrimination: There is a lot of age discrimination in the software programming field. Many people think that a person above 40 would not be able to perform well. Preference is given to the young developers because it is assumed that they have fresh mind and would be able to solve the programming puzzles and tricks easily as compared to the old brains. Also young developers will cost less to the companies.

5. Long hours, Tight deadlines and no personal and social life: In IT field, you are bound to the tight deadlines and have to work for long hours and on weekends to meet the deadlines. Most of the Software developers have to sacrifice their personal and social life to make the deliveries on time. 

Friday 7 February 2014

Should Interviewers ask Puzzles to Software Developers in an Interview to evaluate their skills?

Should Interviewers ask Puzzles to Software Developers in an Interview to evaluate their skills?

Programming is not about writing lines of code, it is about solving problems for the people. Some interviewers ask puzzles in an attempt to gauge software developer's ability and approach to solving problems. Puzzles can be useful in assessing problem solving skills, which is of course one of the key aspects of programming. Interviewer's expectations in that case are to hear you articulate your approach to the problem. What other data would you try to gather? How would you test your hypothesizes, etc. The point of asking the puzzles is to watch how developers work toward the solution, not necessarily if they get the right answer. You can spot good programmers pretty quickly just by watching this process. The interviewer must have been referring to problem solving and logic skills, which is part of the everyday work of a programmer. When given a problem, you need to be able to analyze it, subdivide it, and write a solution for it by using the most optimal approach.

Personally, I don't think that such puzzles provide an accurate indicator. I cannot understand the connection between such puzzles and programming. In the "real world", you have more than five minutes to figure out if your dealing with a bin packing vs a back pack problem, for instance. Initially, it's sometimes easy to misunderstand the problem at hand until you're in the middle of applying the wrong solution. That happens to people with 1, 5, 10 or even 20 years of experience.

The best interview 'puzzles' are the ones where you sit down at a computer to solve a problem in the domain in which you claim expertise. I also dislike the "Well, a programmer should be able to ..." thinking because it doesn't take into consideration that people get anxious when hit with something unexpected in a setting that is already stressful. Sure, you could solve that if you had time to think about it.. and perhaps you could solve it faster if you realized that your life would be over if you didn't. Do you want to work somewhere where your life will be over if you can't solve problems in five minutes? Will you get fired if you can't?

Should all great programmers also be champion sudoku solvers? I'm sure that plenty are, but it's not like some kind of prerequisite for competency.

I'm not saying that you should not be tested on how you approach problems, but the tests should be fun and invite the 'best' that the applicant has to give, given their area of expertise. Proving that you are as smart as a character that Bruce Willis portrays seems kind of pointless, considering that producers spent a pretty sum to get that scene just right.

These sorts of puzzles are generally used by interviewers who neither know what they are doing nor how to look for developers? These are just voodoo hiring practices. Some interviewers ask these questions so they feel like they are supposed to. They know that not answering the question is "bad" and answering is "good", but they can't tell you why beyond non-answers like "a developer needs these skills". They are a waste of time and an indicator that the interviewer is not a competent interviewer. In other words, if you detect that you're being interviewed by someone who has little comprehension over what you'll actually be doing, excuse yourself to go to the restroom and never return.

Suggestion to Interviewers

It is far better to ask coding questions to the software developers. In other words, you need to ask questions that allow you to explore the skills and behaviour of the software developer as they try and tackle the problem. Asking silly puzzles instead of coding philosophies will not give you any indication about how good that person is for the job.

Always try to make the applicant feel as comfortable as possible, so that you can actually try to find out how good that person will be for the job. The best programmers are those who understand the dynamics of software development, even if they don't have the highest IQs.

Tuesday 4 February 2014

Amazon AWS vs IBM SoftLayer: Why IBM cannot dominate Amazon as a Cloud Computing Services Provider?

Amazon AWS vs IBM SoftLayer: Why IBM cannot dominate Amazon as a Cloud Computing Services Provider?

Can IBM SoftLayer ever dominate Amazon AWS? Today, Amazon is the biggest Cloud Computing Services provider. Amazon AWS already has a number of large enterprises running production workloads on it, and the trend is accelerating. IBM is unquestionably a strong brand with deep customer relationships — it exerts a magnetism for its customers that competitors like HP and Dell don’t come anywhere near to matching. 

Why IBM SoftLayer cannot dominate Amazon AWS?

1. Is IBM SoftLayer worthy?

IBM's own cloud did not work, and now it has thrown out that strategy and is now pinning its hopes on SoftLayer, which was never a credible AWS competitor to begin with. IBM acquired SoftLayer last year and announced addition of more than 1,500 customers just after three months of its acquisition of SoftLayer.  It certainly helps immensely that SoftLayer is a more compelling solution than SCE, but customers continue to acknowledge that they don’t necessarily feel they’re buying the best solution or the best technology, but they are getting something that is good enough from a vendor that they trust. SoftLayer has always competed to some degree against AWS (philosophically, both companies have an intense focus on automation, and SoftLayer’s bare-metal architecture is optimal for certain types of use cases), and IBM SoftLayer will as well.

2. Amazon is not limited by the traditional IT constraints

The fact that Amazon does not have a long history in enterprise IT is precisely why it's the preferred public cloud solution. It doesn't have legacy baggage, so is not limited by the traditional constraints we place on IT and IT technology providers such as IBM. Amazon AWS is also very disruptive to traditional enterprise vendors because Amazon doesn't care all that much about profit margins. Amazon's stated strategy is to invest more money in growing market share and capability rather than taking profits. Amazon was able to build its offering from the market requirements up. It doesn't have to deal with maintaining synergy with existing and ageing product lines, nor does it have to deal with the internal politics as IBM does.

3. IBM won't beat Amazon -- or the other major cloud providers, for that matter -- because IBM is, well, IBM. IBM has done a poor job in both understanding the cloud computing marketplace and providing compelling products to capture the market.  Although IBM does understand the enterprise and certainly has the sales force to go sell stuff to enterprises, it doesn't have a culture prepared to promote public cloud services, which are very different than enterprise hardware and software. 

In addition, the more cloud services that IBM sells, the less money it will make. In essence, it will displace existing IBM hardware and software with its own public cloud offering. If not, Amazon, Microsoft, Rackspace, and Google will displace IBM hardware and software. It's truly a no-win situation for IBM, but other large enterprise providers are in the same boat.

Statistics

If you go with a cloud services only argument, AWS is twice as large as IBM. If you include hardware in the cloud revenue equation, the two are about equal on revenue give or take a few million. IBM claims that IBM Cloud supports 270,000 more Web sites than Amazon and supports 24 of the top 25 Fortune 500 companies. Amazon took in around 35 percent of the $1.2 billion spent globally on public IaaS in the fourth quarter of 2012, and IBM came in a distant second with 5 percent, according to Synergy Research Group. Other studies show the same (or worse) for IBM, with a few analyst firms leaving IBM off the research altogether, instead naming Rackspace, Microsoft, and Google as Amazon's true competitors. Gartner states that Amazon AWS has 5 times the size of the next 15 cloud vendors combined. 

As for pricing comparison's IBM's SoftLayer has the most AWS-ish pricing schemes. SoftLayer's pricing is transparent. IBM's other cloud calculators take a bit more work. The biggest takeaway is that AWS is on its enterprise rivals radar in a big way.

Conclusion

IBM SoftLayer has a strong value proposition for certain use cases, but today their distinctive value proposition is a different one than AWS’s, but a very similar one to Rackspace’s. But IBM SoftLayer is still an infrastructure-centric story. I don’t know that they’re going to compete with the vision and speed of execution currently being displayed by AWS, Microsoft, and Google, but ultimately, those providers may not be IBM SoftLayer’s primary competitors.

AngularJS vs Ember vs Backbone: Which Javascript Framework to choose for Front-end Web Development?

AngularJS vs Ember vs Backbone: Which Javascript Framework to choose for Front-end Web Development?

I have tried to compare three most widely used Javascript frameworks like AngularJS, Ember and Backbone in terms of their performance, model mutation, template engine, testability, easy to learn and implement etc. Which javascript framework to choose for front-end web development is mainly decided by the nature of your application, what functionalities do you want to achieve in your application and your hold on the Javascript framework. Let's try to understand the difference between the various features of AngularJS, Ember and Backbone.

1. Templates

Backbone: In backbone, you can choose your own template engine, no matter whether it’s String or DOM based. Usually people prefer handlebars.js, a string-based template library.

Ember: It uses built-in string-based templates (mandatory). Arguments in favor of string-based templates include “it’s faster” (debatable) and “theoretically, the server can render them too” (also debatable, as that’s only true if you can actually run all of your model code on the server, and nobody generally does that in practice).

AngularJS: Angular uses built-in DOM-based templates (mandatory). DOM-based templates means doing control flow (each, if, etc.) purely via bindings in your actual markup and not relying on any external library. Argument include “it’s faster” (debatable) and “the code is easier to read and write”

In AngularJS, the DOM structure is created on pageload. Suppose you have multiple templates in your page and you don’t want to show them at a time. In that case also you have to define those at page load lavel, if you use angular, which will unnecessary create few extra DOM elements. But in Ember you can insert dynamic templates as it uses string based templating method. So in this perspective Ember and Backbone’s string-based templating may go handy, but if you talk about data binding, DOM-based templates provides you better performance. According to the Angular developers’ team, in near future DOM-based templating will be natively supported on browsers and when this happens, Angular apps will run way too faster, so we should best prepare ourselves for the future by adopting it now. AngularJS is from Google, so they are already working on this with Chromium and standards bodies.

2. Model Mutation

Backbone & Ember: In model mutation both Backbone and Ember follows almost the same structure and flow. They use getters and setters to get or set a value and this is also an efficient way to learn the model change and accordingly reflect it to view. But while rendering the data elements, ember adds observers to each element. As the observers are heavy, so it makes the rendering process slower.

AngularJS:  Angular doesn’t use the traditional getters and setters like backbone and ember, rather it uses Dirty Checking to learn the model change, which is way too faster (according to the angular team).

AngularJS uses Dirty Checking, which is based on the lexical scoping in js and helps in garbage collection too. Not only that, angular lets all the model mutation to happen first and then inform all the listeners in a consistent state. This helps to prevent wrong data operations.

3. Performance

Performance is something, which you just can’t judge only basing on the pros and cons of the framework. Rather, it completely depends on your needs and the type of app you are developing. The key performance judging factors are given in the examples below.

Eg 1: Suppose, in your app, you are using huge number of data. So if you use ember, you will find the app is taking too much time to get loaded; and that’s because ember adds observers to each element. So this thing makes the rendering very slow in comparison with backbone and angular. But once the app is loaded, and you expecting your view to reflect the model change immediately; well angular will make you sad. Because, as it don’t have an observer attached with each element, so to learn the data change, the angular controller has to traverse the whole data model (dirty checking). But if your app doesn’t depend on fast data binding; rather you want your app to load faster, angular is the best option.

Eg 2: AngularJS is sort of a HTML compiler. It has the power to manipulate the normal behaviour of your HTML. Suppose, you are printing the data of your model one by one using {{#each}} helper in ember (actually in handlebars), or using the ‘For’ loop of backbone. In this case ember will run a loop to print them; and as you know, loops are always heavy and time consuming operations. But in a similar situation, angular’s ‘ng-repeat’ will fetch the data as a whole and will put it directly on your html. This is a much faster process.

Eg 3: Suppose your app is a continious animation based app, where you have to perform some animation to each element in your model (let your model has the instances of few html elements or something similar to that). So here, ember’s observers will be of no use; cause no matter what, you have to change the model and view continuously. So angular’s continuous checking or dirty checking may play a role for you here.

So, this is how, performance is a variable thing, which varies from projects to projects, scenarios to scenarios, environments, dependencies and many more. So only that framework can give you best performance which is the most compatible one to your app.

4. Learning & Development

Backbone: Basic backbone is very easy to learn, but while developing, you will find it was not enough. Because only using backbone you can’t structure your code much. It needs more libraries and templates to make a proper project.

Ember: Ember has more structured documents and it’s also not that tough to learn. Its implementation (with handlebars) is much similar to the other process and object oriented programming.

AngularJS: Angular is a little tricky, because it’s somewhat an extension of HTML. But once you get this html processing, it will become the simplest framework to learn.

AngularJSis comparatively simple to learn, and more simple to develop. A friend of mine made a widget on backbone, which was of more than 3800 lines. It has come down to 725 lines when rewritten in Angular. And the code was more structured and clean. Simplicity is one of the best plus points of Angular.

5. Testability

Testing is possible on all the frameworks, if you learn the right pattern to develop your project. Your modularity and ability of dependency injection are the key parts to have a testable code. And modularity and dependency injection are two of the major features of angular. Angular itself was built keeping the testing facility in mind. So I think, in testability angular is ahead of Backbone and Ember.

6. Projects point of view

While developing, or before starting the development of a project you need to keep in minds many points; and these really plays the role behind the selection of the framework.

There was a time when the codes of backbone seemed to be very clean and structured. But ember and angular showed the codes can be more cleaner and structured. Let’s watch these three frameworks as project developers point of view.

Backbone: Maximum people has worked with backbone; so it’s much easier to found an experienced backbone developer. There are lot of help available there in the net about backbone. It won’t cost you much to train your people. So in this point of view, backbone is good.

Ember: The best thing about ember is, if forces you to follow the ember way; and if you don’t, the app will never run. Though for beginners it will be a headache; but the best thing is; as everyone will follow the same way to develop the app, so it will be well structured and very very easy to maintain in future. Everyone is not a good coder; and humans always like shortcuts. So, if you are developing a huge project with lots of developers, they can’t code any logic wherever they want. They have to strictly follow the MVC structure and ember’s way of coding.

AngularJS: What if you don’t have much time to develop your project? Not much time to learn frameworks? Then you must go with the angular way. Angular also makes the code much more cleaner, structured and maintainable if the developer has knowledge of MVC development. It reduces the lines of codes like anything.

Conclusion

It’s not like a single framework will be always the best one. I’ve also given examples for that in this article. There are lot of factors you need to take care of before selecting the javascript framework for your application. I’m working in a travel service company right now and we selected Ember over Angular for our development, because it was more suitable to our previous architecture and widget based development. Similarly lot other environmental factors will come.

Every framework has its pros and cons. But what we need to consider is, the requirement list of our project and the adaptability of the framework on those requirements. But as an overall view, I’ve found out angular is very easy to learn (even a guy who didn’t work much with MVC and just knows simple HTML and javascript, can learn it very easily); it reduces the number of lines in your code more than backbone and ember; if your data model is not huge, it provides you fast rendering and execution; manipulates the DOM directly; makes your code testable and lot more. That is why I’m considering Angular a better option than Ember and Backbone generally.

Monday 3 February 2014

Basic AngularJS Interview Questions and Answers for Front-end Web Developers

Basic AngularJS Interview Questions and Answers for Front-end Web Developers

AngularJS is widely known Javascript framework. If you are a front-end web developer preparing for AngularJS interview, following basic AngularJS interview questions and answers might help you little bit. Before going to AngularJS interview, you should know basic concepts and architecture of AngularJS, key features of AngularJS, how AngularJS is different from jQuery or other Javascript frameworks etc. Following basic AngularJS interview questions and answers will give you little insight of these concepts.

1. Why is this project called "AngularJS"? Why is the namespace called "ng"?

Because HTML has Angular brackets and "ng" sounds like "Angular".

2. Is AngularJS a library, framework, plugin or a browser extension?

AngularJS fits the definition of a framework the best, even though it's much more lightweight than a typical framework and that's why many confuse it with a library.

AngularJS is 100% JavaScript, 100% client side and compatible with both desktop and mobile browsers. So it's definitely not a plugin or some other native browser extension.

3. Why to choose AngularJS Javascript Framework for front-end web development?


4. What are the key features of AngularJS?

Scope

The job of the Scope is to detect changes to model objects and create an execution context for expressions. There is one root scope for the application (ng-app) with hierarchical children scopes. It marshals the model to the view and forwards events to the controller.

Controller

The Controller is responsible for construction of the model and connects it to the view (HTML). The scope sits between the controller and the view. Controllers should be straightforward and simply contain the business logic needed for a view. Generally you want thin controllers and rich services. Controllers can be nested and handle inheritance. The big difference in AngularJS from the other JavaScript frameworks is there is no DOM manipulation in controllers. It is something to unlearn when developing in AngularJS.

Model

In AngularJS, a Model is simply a JavaScript object. No need to extend anything or create any structure. This allows for nested models  - something that Backbone doesn’t do out-of-the-box.

View

The View is based on DOM objects, not on strings. The view is the HTML. HTML is declarative – well suited for UI design. The View should not contain any functional behavior. The flexibility here is to allow for multiple views per Controller.

Services

The Services in AngularJS are singletons that perform common tasks for web applications. If you need to share common functionality between Controllers, then use Services. Built-in AngularJS, Services start with a $. There are several ways to build a service: Service API, Factory API, or the $provide API.

Data Binding

Data Binding in AngularJS is a two-way binding between the View and the Model. Automatic synchronizing between views and data models makes this really easy (and straightforward) to use. Updating the model is reflected in View without any explicit JavaScript code to bind them together, or to add event listeners to reflect data changes.

Directives

Now this is cool. AngularJS allows you to use Directives to transform the DOM or to create new behavior. A directive allows you to extend the HTML vocabulary in a declarative fashion. The ‘ng’ prefix stands for built-in AngularJS directives. The App (ng-app), Model (ng-model), the Controller (ng-controller), etc. are built into the framework. AngularJS allows for building your own directives. Building directives is not extremely difficult, but not easy either. There are different things that can be done with them. Please check out AngularJS’s documentation on directives.

Filters

The Filters in AngularJS perform data transformation. They can be used to do formatting (like I did in my Directives example with padding zeros), or they can be used to do filter results (think search).

Validation

AngularJS has some built-in validation around HTML5 input variables (text, number, URL, email, radio, checkbox) and some directives (required, pattern, minlength, maxlength, min, max). If you want to create your own validation, it is just as simple as creating a directive to perform your validation.

Testable

Testing is a big concern for enterprise applications. There are several different ways to write and run tests against JavaScript code, thus against AngularJS. The developers at AngularJS advocate using Jasmine tests ran using Testacular. I have found this method of testing very straightforward and, while writing tests may not be the most enjoyable, it is just as importable as any other piece of developing an application.

5. What is a scope in AngularJS?

scope is an object that refers to the application model. It is the glue between application controller and the view. Both the controllers and directives have reference to the scope, but not with each other. It is an execution context for expressions and arranged in hierarchical structure. Scopes can watch expressions and propagate events.

6. Can you explain the concept of scope hierarchy? How many scopes can an application have?

Each Angular application has exactly one root scope, but may have several child scopes. The application can have multiple scopes, because child controllers and some directives create new child scopes. When new scopes are created, they are added as children of their parent scope. This creates a hierarchical structure similar to the DOM where they're attached.

When Angular evaluates a bound variable like say {{firstName}}, it first looks at the scope associated with the given element for the firstName property. If no such property is found, it searches the parent scope and so on until the root scope is reached. In JavaScript this behaviour is known as prototypical inheritance, and child scopes prototypically inherit from their parents. The reverse is not true. i.e. the parent can't see it's children's bound properties.

7. Is AngularJS a templating system?

At the highest level, Angular does look like a just another templating system. But there is one important reason why the Angular templating system is different, that makes it very good fit for application development: bidirectional data binding. The template is compiled in the browser and the compilation step produces a live view. This means you, the developers, don't need to write code to constantly sync the view with the model and the model with the view as in other templating systems.

8. Do I need to worry about security holes in AngularJS?

Like any other technology, AngularJS is not impervious to attack. Angular does, however, provide built-in protection from basic security holes including cross-site scripting and HTML injection attacks. AngularJS does round-trip escaping on all strings for you and even offers XSRF protection for server-side communication.

AngularJS was designed to be compatible with other security measures like Content Security Policy (CSP), HTTPS (SSL/TLS) and server-side authentication and authorization that greatly reduce the possible attack vectors and we highly recommended their use.

9. What's Angular's performance like?

The startup time heavily depends on your network connection, state of the cache, browser used and available hardware, but typically we measure bootstrap time in tens or hundreds of milliseconds.

The runtime performance will vary depending on the number and complexity of bindings on the page as well as the speed of your backend (for apps that fetch data from the backend). Just for an illustration we typically build snappy apps with hundreds or thousands of active bindings.

10. Does Angular use the jQuery library?

Yes, Angular can use jQuery if it's present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.

Due to a change to use on()/off() rather than bind()/unbind(), Angular 1.2 only operates with jQuery 1.7.1 or above.

11. What are the key differences between AngularJS and jQuery?


12. How will you compare AngularJS with other Javascript frameworks like Ember and Backbone?

Read complete answer

13. How will you display different images based on the status being red, amber, or green?

Use the ng-switch and ng-switch-when directives as shown below.

<div ng-switch on="account.status">
 <div ng-switch-when="AMBER">
  <img class="statusIcon"
   src='apps/dashboard/amber-dot.jpg' />
 </div>
 <div ng-switch-when="GREEN">
  <img class="statusIcon"
   src='apps/dashboard/green-dot.jpg' />
 </div>
 <div ng-switch-when="RED">
  <img class="statusIcon"
   src='apps/dashboard/red-dot.jpg' />
 </div>
</div>

14. How will you initialize a select box with options on page load?

Use the ng-init directive.

<div ng-controller="apps/dashboard/account" ng-switch
 on="!!accounts" ng-init="loadData()">

15. How will you show/hide buttons and enable/disable buttons conditionally?

Using the ng-show and ng-disabled directives.

<div class="dataControlPanel"
    ng-show="accounts.releasePortfolios">
     
    <div class="dataControlButtons">
     <button class="btn btn-primary btn-small"
      ng-click="saveComments()" ng-disabled="disableSaveButton">Save</button>
     <button class="btn btn-primary btn-small"
      ng-click="releaseRun()" ng-disabled="disableReleaseButton">Release</button>
    </div>
</div>

16. How will you loop through a collection and list each item?

Using the ng-repeat directive.

<table
  class="table table-bordered table-striped table-hover table-fixed-head portal-data-table">
  <thead>
   <tr>
    <th>account</th>
    <th>Difference</th>
    <th>Status</th>
   </tr>
  </thead>
  <tbody>
   <tr
    ng-repeat="account in acounts">
    <td width="40%">{{account.accountCode}}</td>
    <td width="30%" style="text-align: right">{{account.difference
     | currency: ""}}</td>
    <td width="30%">

     <div ng-switch on="account.status">
      <div ng-switch-when="AMBER">
       <img class="statusIcon"
        src='apps/dashboard/amber-dot.jpg' />
      </div>
      <div ng-switch-when="GREEN">
       <img class="statusIcon"
        src='apps/dashboard/green-dot.jpg' />
      </div>
      <div ng-switch-when="RED">
       <img class="statusIcon"
        src='apps/dashboard/red-dot.jpg' />
      </div>
     </div>

    </td>
   </tr>
  </tbody>
</table>

17. How will you add options to a select box?

Using the ng-options and ng-model directives.

<fieldset>
 <dl class="control-group">
  <dt>
   <label for="cientId">
    <h4>Client Id:</h4>
   </label>
  </dt>
  <dd>
   <select id="cientId" class="input-xlarge" ng-model="clientId"
    ng-options="reportClient.clientId as reportClient.clientId  for reportClient in reportClients "
    ng-click="getReportParams()" ng-change="getValuationDates()" />
  </dd>
 </dl>
 <dl class="control-group">
  <dt>
   <label for="valuationDate">
    <h4>
     Valuation Date <small>(dd/mm/yyyy)</small>
    </h4>
   </label>
  </dt>
  <dd>
   <select id="valuationDate" class="input-xlarge"
    ng-model="valuationDate"
    ng-options="reportdate for reportdate in reportDates" />
  </dd>
 </dl>
</fieldset>

18. How will you display inprogress revolving image to indicate that RESTful data is bing loaded?

<div ng-show="loading">
 <img class="loading" src="portal/images/loading_32.gif" />
</div>

 $scope.loadReportData = function($http) {
 $scope.loading = true;  // start spinng the image
 $http(
   {
    method : 'GET',
    url : propertiesService.get('restPath')
      + '/myapp/portfolio/'
      + $scope.clientId
      + '/'
      + dateService
        .userToRest($scope.reportDate),
    cacheBreaker : true
   }).success(
   function(data, config) {
    $scope.reportData = data;
    portal.log('reportData: ',
      $scope.reportData);
    $scope.loading = false;   // stop spinning the image
   }).error(
   function(data, status, headers, config) {
    if(data.errorMsg != null) {
     $scope.httpError = data.errorMsg;
    }
    else {
    $scope.httpError = "Error retrieving data from " + errorService
      .getApacheErrorTitleMessage(status,
        data, config);
       }
    $scope.loading = false;  // stop spinning the image
   });

};

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.