Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Why is it that we need to name our buttons or textboxes (or any object, for that

ID: 3669293 • Letter: W

Question

Why is it that we need to name our buttons or textboxes (or any object, for that matter) with descriptive names? Wouldn't it just be easier to name them btn1, btn2? Or why bother to start our object names with pic, btn, txt, lbl? Isn't that a waste of time? Does it really matter where we put the code? If we want a label to become invisible, does it matter if we place it under the lbl object in the coding window or under a button? Doesn't the enable and visible properties do the same exact thing? What's the point of putting comments in the code?

Explanation / Answer

Answer -

In visual Programming, we can make a name refer to a button, textbox or to labels, and then use the name to represent the object it refers to. Names must be words with no spaces. To make it easy to read multiword names, we can use the convention of capitalizing the first letter of each word or put the underscore character (_) between words: e.g., txtbox_Name or input_class_average or even btn_submit. When we use these names in programming, it makes them easier to read and understand that which object we are refering to: the program might use the defined names instead of referring to the objects.

For example, we are creating a name for object such as txt_name for a textbox so it can help identity of that textbox easy. This naming convention for objects is not an standerd but it makes program reusable and easy to understand. In this way, we are saving lot of time while developing large programs where objects are high in quantity so making use of thses object names identificable saves lot of ime and effort.

Idea of putting the code anywhere is that it should be in the scope of program so compiler does not have complaxity to compile the program. In computer programming, a comment is a programming language construct used to embed programmer-readable annotations in the source code of a computer program. Those annotations are potentially significant to programmers but are generally ignored by compilers and interpreters. No matter how simple, concise, and clear your code may end up being, it's impossible for code to be completely self-documenting. Comments can never be replaced by code alone.

Visible means that the property can be used, but is not visible in the graphical user interface. But, if the user were to click a control that edit the objects properties, the object would change even if it isn't visible. Enabled/Disable means that for instance if the object is Disabled, it's still visible but the user cannot interact with it. This means, that if code is executed for the control that is disabled, nothing will change to that control.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote