Code Snippet / Code Templates
Code snippets allow the developer to add a complex coding structure by typing a minimal amount of text. Code snippets can only be used in a valid context (statements snippets are only offered when you can insert statements).
For example, using the Eclipse IDE to code in Java, a developer can type in "instanceof" then press Ctrl+space which will replace "instanceof" by the following code snippet:
- if (obj instanceof MyClass) {
- MyClass myClazz = (MyClass) obj;
- }
This code snippet can be further customised by the developer, with the IDE placing the cursor:
- on the "obj" variable to choose between the available variables at this point,
- on the "MyClass" type to allow the developer to choose the type, after he pressed the tab key,
- on the "myClass" variable to allow the developer to rename the local variable, after he pressed the tab key,
- on line 3 to allow the developer to continue typing the rest of the code, after he pressed the tab key.
Read more about this topic: Content Assist
Famous quotes containing the word code:
“Faultless honesty is a sine qua non of business life. Not alone the honesty according to the moral code and the Bible. When I speak of honesty I refer to the small, hidden, evasive meannesses of our natures. I speak of the honesty of ourselves to ourselves.”
—Alice Foote MacDougall (18671945)