Skip to main content
Clarification
Source Link
metacubed
  • 966
  • 5
  • 14

InYou need to be aware of all the examples that you describe, usingspecial cases where it is compulsory to use thissuper andor superthis is purely a matter of preference. You seem to be awaredescribed one of the specialthose corner cases like- overridden functions, etc. so I'll concentrateYou will learn more special cases as you go on the "standard" case. There

Other than those specific cases, using this and super is no advantage or disadvantage in termsa matter of actual functionalitypreference. They produce the same machine code, and so they are exactly the same as far as the machine is concerned. However, they differ in terms of their readability to a person.

However, itIt is important to pick one style and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally uses. You may want to discuss this with your team to officially decide on a standard.

In the examples that you describe, using this and super is purely a matter of preference. You seem to be aware of the special cases like overridden functions, etc. so I'll concentrate on the "standard" case. There is no advantage or disadvantage in terms of actual functionality. They produce the same machine code, and so they are exactly the same as far as the machine is concerned.

However, it is important to pick one and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally uses. You may want to discuss this with your team to officially decide on a standard.

You need to be aware of all the special cases where it is compulsory to use super or this. You described one of those corner cases - overridden functions. You will learn more special cases as you go on.

Other than those specific cases, using this and super is a matter of preference. They produce the same machine code, and so they are exactly the same as far as the machine is concerned. However, they differ in terms of their readability to a person.

It is important to pick one style and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally uses. You may want to discuss this with your team to officially decide on a standard.

added 10 characters in body
Source Link
metacubed
  • 966
  • 5
  • 14

In the examples that you describe, using this and super is purely a matter of preference. You seem to be aware of the special cases like overridden functions, etc. so I'll concentrate on the "standard" case. There is no advantage or disadvantage in terms of actual functionality. They produce the same machine code, and so they are exactly the same as far as the machine is concerned.

However, it is important to pick one and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally useuses. You may want to discuss this with your team to officially decide on thea standard.

In the examples that you describe, using this and super is purely a matter of preference. You seem to be aware of the special cases like overridden functions, etc. so I'll concentrate on the "standard" case. There is no advantage or disadvantage in terms of actual functionality. They produce the same machine code, and so they are exactly the same as far as the machine is concerned.

However, it is important to pick one and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally use. You may want to discuss this with your team to decide on the standard.

In the examples that you describe, using this and super is purely a matter of preference. You seem to be aware of the special cases like overridden functions, etc. so I'll concentrate on the "standard" case. There is no advantage or disadvantage in terms of actual functionality. They produce the same machine code, and so they are exactly the same as far as the machine is concerned.

However, it is important to pick one and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally uses. You may want to discuss this with your team to officially decide on a standard.

Source Link
metacubed
  • 966
  • 5
  • 14

In the examples that you describe, using this and super is purely a matter of preference. You seem to be aware of the special cases like overridden functions, etc. so I'll concentrate on the "standard" case. There is no advantage or disadvantage in terms of actual functionality. They produce the same machine code, and so they are exactly the same as far as the machine is concerned.

However, it is important to pick one and use it consistently. By this, I mean not just you, but your entire team. Everyone decides on one way of doing things and sticks to it. This makes it easy to understand the team's code. This is called a "coding standard".

Check if there are any published coding guidelines or coding standards set by the company or the team. If yes, just follow them. Otherwise, see what the rest of the team normally use. You may want to discuss this with your team to decide on the standard.