Login

Welcome, Guest. Please login or register.

September 11, 2025, 05:31:03 am

Author Topic: Need help working on my response to this question  (Read 1276 times)  Share 

0 Members and 1 Guest are viewing this topic.

silverpixeli

  • ATAR Notes Lecturer
  • Victorian
  • Forum Leader
  • ****
  • Posts: 855
  • Respect: +110
Need help working on my response to this question
« on: October 12, 2013, 10:18:46 am »
0
Insight 2011 Exam Section B Question 3b

A newly-hired programmer goes to his boss and says, "Hey boss. Our style guide says we need to prefix every variable name with its type, like int_Age or float_Salary. But we already declare out variable types when we create them at the start of each program, like DECLARE int_Age as INTEGER. Isn't that enough?"
What do you think the boss replied to the new programmer? Be sure to make his justification clear. 2 marks.

My answer:

"Listen WELL, slut, having a prefix is necessary as it ensures code is unambiguous throughout. No self-respecting developer or maintenance coder of integrity wants to be constantly referring back to the declaration space to see what type of variable he's working with. You're fired."

Any tips on how I could improve my response? Much appreciated.
« Last Edit: October 12, 2013, 10:23:16 am by silverpixeli »
ATAR 99.80 :: Methods [50] | Physics [50+Premier's] | Specialist [47] | Software [48] | English [42] | Legal [39 '12]
+ Australian Student Prize

ATAR Notes Specialist/Methods/Physics Lecturer
ATAR Notes Specialist Maths Webinar Presenter

silverpixeli

  • ATAR Notes Lecturer
  • Victorian
  • Forum Leader
  • ****
  • Posts: 855
  • Respect: +110
Re: Need help working on my response to this question
« Reply #1 on: October 12, 2013, 12:26:41 pm »
0
not serious :P
ATAR 99.80 :: Methods [50] | Physics [50+Premier's] | Specialist [47] | Software [48] | English [42] | Legal [39 '12]
+ Australian Student Prize

ATAR Notes Specialist/Methods/Physics Lecturer
ATAR Notes Specialist Maths Webinar Presenter

Lasercookie

  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 3167
  • Respect: +326
Re: Need help working on my response to this question
« Reply #2 on: October 12, 2013, 02:02:12 pm »
+2
Another way of answering the question would be to suggest a different naming convention. I'd probably start off with explaining that there are many different naming conventions, each with their pros and cons. You could then point out a flaw of the current naming convention, and then suggest another naming convention to improve upon it.

The problem I'd see with using the datatype_Descriptor naming convention is that it'd impact on the readability of your code, by littering it with what I'd argue is superfluous information. It's much better to have your variable names be as concise as possible when telling you what it actually does. If you didn't know what kind of data int_Age holds, then knowing it's an integer probably isn't going to help. It's the descriptor part of the variable name that really reminds you what the variable does, so that's what should be emphasised.

If you were using an IDE, well you'd have autocomplete available for variables, in which if all your variables started with a datatype, you'd get a huge list of them appearing. Not to mention an IDE will probably remind you of the data type. Not sure if that's an explanation they'd be looking for in SD.

Another argument for keeping with the naming convention in the question would be if you change the style guide now, you might be breaking consistency with the current code base, which might have thousands of lines of code.
« Last Edit: October 12, 2013, 02:04:13 pm by Lasercookie »

MJRomeo81

  • Part of the furniture
  • *****
  • Posts: 1231
  • Princeps
  • Respect: +167
Re: Need help working on my response to this question
« Reply #3 on: October 12, 2013, 08:57:29 pm »
0
Ewwww Hungarian notation. Type-checking is done by the compiler. Checks by eye are largely redundant.

Quote
Another argument for keeping with the naming convention in the question would be if you change the style guide now, you might be breaking consistency with the current code base, which might have thousands of lines of code.

+1

If that's what the company is using then the style must be adhered to for the sake of the code base.
Currently working in the IT Industry as an Oracle DBA (State Government)

Murphy was an optimist

Bachelor of Information Technology @ La Trobe (Melbourne) - Completed 2014
WAM: 91.96
The key, the whole key, and nothing but the key, so help me Codd.

Subjects I tutored during my time at LTU:
CSE2DBF (Database Fundamentals)
CSE1IS (Information Systems)
CSE2DES (System Design Engineering)

Quote
“If I had an hour to solve a problem I'd spend 55 minutes defining the problem and 5 minutes thinking about solutions.”
― Albert Einstein