Sly_Squash
06-25-2004, 05:30 PM
Hi guys,
Sorry I just had to vent after a tough days work.
I'm a coop at an international paper-making company. My job is pretty much to make web applications in ASP.NET for various users throughout the company (like Sales, Accounting, etc.) to do their job better, for instance a site where they can retrieve reports and such.
My most recent assignment was to develop an addition to a web application created by a senior systems analyst in my department that allows him to quickly add users and such and to handle assigning privileges within the system to them.
Essentially these privileges fall under "privilege groups", which means in the database each "privilege" links to a "privilege group" record.
I decided that while I was at it making him a page where he can create new privileges I might as well allow him to make new privilege groups too.
After I did this, he told me to remove that functionality. I wondered why, and he told me it was because if a privilege group was added to the DB the program would require modification.
I looked at the rest of the application and saw what he was talking about.
--> HE HARD-CODED THE ID OF EACH PRIVILEGE GROUP IN THE DATABASE INTO AN ENUM.
As in like:
Public Enum Privilege_Group
Sales = 1
Accounting = 2
...
End Enum
Do you think it is good programming practice to hard-code the ID's of certain records in the database into your program? Whenever you add a new group to the DB, you have to add it to this Enum. Sure, it's easy for him, but I strongly doubt the next guy will know this. Did I mention his documentation is lacking too...
In my world, a database stores *data*. You should be able to add/remove data without having to recompile your program and change hard-coded ID's!!!
The only thing this enum is for is so that he can pass a "Privilege_Group" type between functions (it basically is a narrowing conversion on Integer to only allow Integers that exist in the Privilege_Group table).
However, if type-checking is what he's worried about, I had a solution.
Make a Privilege_Group class!! I've found quite often it's nice to make a class for each database table. Then you can make a function where you pass it the ID of a record in that table and it returns the record as that type.
For example,
Public Class Privilege_Group
Protected ID As Integer
Protected Description As String
...
End Class
You could then alleviate a lot of parameter passing because all fields are encapsulated in this object.
I told him I had come up with an idea for how he could change his project so that changes could be made to even the privilege group table and the application would behave just fine without requiring changes to his little Enums (which could be eliminated). He simply said "don't worry about it" and showed considerable discontent with me even suggesting I could improve his code in any way.
I know I am simply an intern, but I am a software engineering major. Some (including him) feel we *are* Computer Science majors, but trust me; there are differences. Mainly, software engineers (at least at my school) focus FAR more on how to DESIGN software in an OOP environment and less on actual implementation. This makes sense, because engineering in general is largely based in design.
I feel many senior programmers who were based in the days of spaghetti code have difficulty truly making the switch to OOP. I feel because that he thinks because he skimmed part of an OOP book or two and picked up a few things in industry that he is an expert. I feel you need to undergo programming challenges that specifically encourage strong OOP to pass to really understand how to make it useful.
In former and likely future programs, he has and will continue to hard-code several elements of his programs to the database. It would have taken merely 5 minutes for him to listen to my solution and fix what I see as a terrible programming practice, and I was quite offended when my suggestion was dismissed likely due to lack of corporate stature. As one of the top students in my class (top 2%, and I am an engineering major) I am not used to having my ideas blown off like this.
Have any of you ever run into some seriously-stubborn IT people? How do you get through to them when they quite often become quite perturbed if you even mention something in their code, such as a global variable, could be done better if done slightly differently?
**end vent**
thank you for reading.
Sorry I just had to vent after a tough days work.
I'm a coop at an international paper-making company. My job is pretty much to make web applications in ASP.NET for various users throughout the company (like Sales, Accounting, etc.) to do their job better, for instance a site where they can retrieve reports and such.
My most recent assignment was to develop an addition to a web application created by a senior systems analyst in my department that allows him to quickly add users and such and to handle assigning privileges within the system to them.
Essentially these privileges fall under "privilege groups", which means in the database each "privilege" links to a "privilege group" record.
I decided that while I was at it making him a page where he can create new privileges I might as well allow him to make new privilege groups too.
After I did this, he told me to remove that functionality. I wondered why, and he told me it was because if a privilege group was added to the DB the program would require modification.
I looked at the rest of the application and saw what he was talking about.
--> HE HARD-CODED THE ID OF EACH PRIVILEGE GROUP IN THE DATABASE INTO AN ENUM.
As in like:
Public Enum Privilege_Group
Sales = 1
Accounting = 2
...
End Enum
Do you think it is good programming practice to hard-code the ID's of certain records in the database into your program? Whenever you add a new group to the DB, you have to add it to this Enum. Sure, it's easy for him, but I strongly doubt the next guy will know this. Did I mention his documentation is lacking too...
In my world, a database stores *data*. You should be able to add/remove data without having to recompile your program and change hard-coded ID's!!!
The only thing this enum is for is so that he can pass a "Privilege_Group" type between functions (it basically is a narrowing conversion on Integer to only allow Integers that exist in the Privilege_Group table).
However, if type-checking is what he's worried about, I had a solution.
Make a Privilege_Group class!! I've found quite often it's nice to make a class for each database table. Then you can make a function where you pass it the ID of a record in that table and it returns the record as that type.
For example,
Public Class Privilege_Group
Protected ID As Integer
Protected Description As String
...
End Class
You could then alleviate a lot of parameter passing because all fields are encapsulated in this object.
I told him I had come up with an idea for how he could change his project so that changes could be made to even the privilege group table and the application would behave just fine without requiring changes to his little Enums (which could be eliminated). He simply said "don't worry about it" and showed considerable discontent with me even suggesting I could improve his code in any way.
I know I am simply an intern, but I am a software engineering major. Some (including him) feel we *are* Computer Science majors, but trust me; there are differences. Mainly, software engineers (at least at my school) focus FAR more on how to DESIGN software in an OOP environment and less on actual implementation. This makes sense, because engineering in general is largely based in design.
I feel many senior programmers who were based in the days of spaghetti code have difficulty truly making the switch to OOP. I feel because that he thinks because he skimmed part of an OOP book or two and picked up a few things in industry that he is an expert. I feel you need to undergo programming challenges that specifically encourage strong OOP to pass to really understand how to make it useful.
In former and likely future programs, he has and will continue to hard-code several elements of his programs to the database. It would have taken merely 5 minutes for him to listen to my solution and fix what I see as a terrible programming practice, and I was quite offended when my suggestion was dismissed likely due to lack of corporate stature. As one of the top students in my class (top 2%, and I am an engineering major) I am not used to having my ideas blown off like this.
Have any of you ever run into some seriously-stubborn IT people? How do you get through to them when they quite often become quite perturbed if you even mention something in their code, such as a global variable, could be done better if done slightly differently?
**end vent**
thank you for reading.
