When would I use = vs == in programming?

Answering a programming beginner.

Answer by Sharmilli Priyadarsini:

= is an assignment operator, we use a "equal to" symbol whenever we want to assign right hand side RHS value to the left hand side LHS.

int a = 1;

// the value 1 is assigned to the variable "a", whenever you use "a" it automatically takes the value of "a" as 1 as long as it is not modified to some other value within the scope of the variable.

== is a logical operator, that you usually use while checking the left
hand side LHS is exactly equal to right hand side RHS. The other logical operators are < Less than ,> greater than,<= less than or equal to ,>= greater than or equal to ,!= not equal to. The output of logical operator is always true or false. You will be using this operator in condition statements like if and ternary operators uses both = and ==.

int a=1;
int b= 2;
int c= 1;

//Conditional operator returning true or false uses ==


//true since value of a and c are equal ie 1.

a=b;// assignment operator uses =, now value of b is assigned to a, so value of "a" is equal to 2.


//ternary operators also uses == to check for true or false, followed by assigning the  values to LHS from true section if condition in == satisfies, otherwise assign the false section to LHS.

// now a,b are equal with the value 2 and value of c is 1

c= a==c?c:b;

// The above is a ternary statement, first it checks if value of a is equal to c, if it is equal then c remains same, otherwise b overwrites the value of c.

//  Now a,b,c are all equal with the value 2

When would I use = vs == in programming?

Do you think Indians need social media civic sense?

Answer by Sharmilli Priyadarsini:

Before answering this, I am afraid there is a high degree of generalization in this question doubting the social media ethics and civic sense of all Indians. We cannot forget the role played by Indians in the social media in recent few years that has resulted in miraculous political changes across the country. Not to forget the 2014 parliamentary elections and its results, the protest against corruption to pass the lokpal bill, Kejriwal became the Chief Minister of Delhi, Student strike in tamilnadu against the killing of Sri Lankan tamils that stunned the educational institutions for days, all thanks to the social media and to the political awareness of the people who are watching the happenings of the country closely.

Criticizing politicians is nothing new to the people of India and we enjoy talking politics as much as we enjoy watching cricket. Yes, I agree with the fact that the people are behaving cheaply against the politicians they do not like. But our great politicians are not any lesser and they are very much good at taking filthy revenges instead fulfilling the pre-election promises.The arrest of 2 young girls in Maharashtra as a result of their Anti-Thackeray facebook status and the arrest of professor Ambikesh Mahapatra for having forwarded a cartoon about West Bengal CM Mamata Banerjee are few examples of the lowly acts by the politicians.

We still have the cybercrime laws enact and actions have been taken against cyber bullying. One such example is the arrest of a professor in Chennai based on a harassment complaint reported by the south indian singer Chinmayi(Chennai professor arrested for tweets about singer Chinmayi).

Nobody is against being ethical or behaving civilized. Everyone welcomes common sense. All we are afraid of is the misuse of laws against the innocent. Lets us not appreciate the internet censorship as it would take away the right to press and freedom of speech and expression, Instead educate the people and kids to behave cultured.

Do you think Indians need social media civic sense?

What’s it like to live in Thiruvananthapuram?

Answer by Sharmilli Priyadarsini:

Trivandrum is a place that is very well painted by nature that you have got a lot of tourist places to visit like the famous Padmanabhaswamy temple, Kovalam beach, Ponmudi hills, veli tourist village, Shangumugham beach, well maintained trivandrum zoo, Neyyar dam etc. Rainfall is prominent here with moderate climate.

In terms of transportation, roads are considerably good. Government busses are connecting the city very well. Auto rickshaws and taxis are little expensive, sometimes they demand double the charge, especially when you want to travel from the bus stand to kazhakootam(IT hub of trivandrum).

The cost of living is very less compared to the other cities. You do not have too many shopping malls to spend money lavishly. Accommodation is cheaper if you go for paying guests or hostels. Being a tourist spot, hotels are costly compared to the service provided. Overall, its a good place to save money.

There are very few foreign fast food outlets. You can find KFC restaurant in QRS mall, if you are a big fan of it. In the tourism centers, you can see dual price tags for food, one for the locals and the other for the tourists which is usually very costly. This place is a feast for non-vegetarian lovers and those who love keralite cuisine.

What's it like to live in Thiruvananthapuram?

As a Computer Science student, would it be better to take an internship where I’ll be programming in C++ in a Linux environment, or one w…

Answer by Sharmilli Priyadarsini:

I would suggest you take your internship on C++ on Linux. The reasons are,
1) though C# (C++++) is claimed to be Microsoft's improvised version of C++ , C# is just a dedicated Microsoft language that is written to make the best use of. NET framework, C++ had richer features over the latter and powerful enough to write system softwares. In fact, MEF is brought to. Net only in version 4.0 which used to be there in visual C++ forever.
2) Startups usually go for open-source software stacks instead going for Microsoft stack due to the licensing cost. So C++ is a recommended choice.
3) As a fresher,  your .Net skills are least important than your C, C++ and oops skills during the interviews.
4) You will probably be given with a .Net training by the company if you get into .Net stream in service conserns.

As a Computer Science student, would it be better to take an internship where I'll be programming in C++ in a Linux environment, or one w…

What is the typical thought process of an experienced programmer doing a code review of a new developer who is a fresher?

Answer by Sharmilli Priyadarsini:

Inspite of the experiences, people make mistakes, but the number of mistakes done by a fresher will be greater than the experienced. Moreover, you cannot learn if you do not make mistakes. A senior programmer doing the code review of another, will look for the same mistakes he did in the early stages of his career and advise his peer how to fix the mistakes and about the best practices to be followed while coding. Sometimes the code review will be a learning experience for the senior programmer also.

All we have to do is, being open for the comments and share your knowledge despite your experience.

What is the typical thought process of an experienced programmer doing a code review of a new developer who is a fresher?

What should one learn in the field of programing, application development, or web development if they have one month of free time?

One month of Leisure time for a tech savvy….

Answer by Sharmilli Priyadarsini:

One month is a good span of time either to learn a new technology or to master and expertise in the technology you have knowledge about.

If you love what you do currently, explore what are all the new things in your area and what is hot in the market, practice them to master your skills. For your information, MVC and MVVM has got a great hype in JAVA, .NET and PHP these days, learn knockoutjs (Page on knockoutjs.com) or Kendo UI HTML5 (Page on telerik.com) or Backbone js or angular js like khyati Desai said or you can learn Mobile application development. Bid some freelance projects and work on them.

Meanwhile think about the right idea for creating your dream application, web/mobile. Execute the idea into a application of your choice, market it.

What should one learn in the field of programing, application development, or web development if they have one month of free time?

Which standards must developers know for programming?

Programmer's checklist

Answer by Sharmilli Priyadarsini:

The below are few things to be kept in mind while coding,

1. Make your code readable with proper indentations.
2. Follow the coding standards recommended. This depends on the language and the practices followed in your project.
3. The naming convention should always be related to the functionality. A text box that invites employee names can be named as EmpName instead being called as TextBox1.
4. Make sure all the methods/functions are annotated explaining the function. Add your inline comments inside the code blocks whenever there are complex steps or logics handelled.
5. Using the right source control and IDE can really help.
6. Do not try to reinvent the wheel, If there are any inbuilt library functions available or tested algorithms available to serve your purpose, reuse them. This will improve the efficiency of your program.
7. Follow the best practices prescribed by the programming language.
8. Most importantly learn and practice.

Which standards must developers know for programming?