When I transitioned over to the desktop software support team in March, I inherited a little web application that our users use to request software packages that can be pushed out to their desktops. This application was written entirely in-house by the guy that I replaced. It’s fairly good, no doubt, and written in C#. For months, I haven’t had to troubleshoot anything with this… until recently.

I have been trying to address a problem with it where sometimes different information regarding the requestor is being sent than the person who actually filled out the form. First by coincidence, but now I’m seeing a pattern. The incorrect information seems to be from the previous submitter’s session. It’s like the SessionState is not being cleared out when it expires. I have checked the code numerous times and I think I’m following the flow correctly, but sometimes it is hard to tell since I have to jump up and down throughout the file. An appropriate analogy would be something like a monkey on a trampoline. Jumbled code aside, the program should work fine. I’m currently looking into either changing the SessionState to another mode or just enacting the Session.Clear(); function on the start of a new session. I know it sounds really redundant but if it works, our users will be happy. I don’t have to like the silliness of the solution. [edit: Actually, I’ve added a Session.Abandon(); at the end of the submission process to clear out any lingering keys. - 07/03/06]

Maybe I’m a bit obsessive about it, but I’m a stickler for well-structured code. Not only does it make programming itself easier but it makes it easier for other people to understand what exactly is going on. Heck, some day it will make it easier for the original developer to know what they wrote. When you’re in the midst of thousands of characters during a debug, it’s best to have some legibility. I’m not really sure why functions were jumbled around so much in this application. It might have been the developer or it might have been Visual Studio. My style would have been to place most of the functions in an external include file while only keeping the main routine and private and localized functions within the main page. I’ve been thinking about rewriting it but that probably wouldn’t get me any extra points with the bosses. I know I’d better understand it but I think I’ll live. Although the overall layout and design of the site may need some tweaking…


70 Responses to “Spaghetti Code and Meatballs”  

  1. 1 Rick

    I have taught you well, young apprentice. Clean, well-structured, unobfuscated code is a many splendored thing. If only WSU had not killed the joy of programming for me.

  2. 2 Adam

    You had WSU. I almost had a certain professor at Sinclair kill it for me. I’d like to think I’ve become stronger than the Dark Side and not give into her delusions of grandeur.

    I hate how WYSIWYG editors add in their own proprietary tags and attributes, especially Microsoft’s. I thought FrontPage did it bad, but now I have seen what Visual Studio 2003 does to simple HTML. With the code in question above, I think I got the problem licked. A co-worker mentioned that he was having some interesting yet stupid things happening with the SessionState on the servers like I was with this particular application. The moral of this story is the old saying, “If you want something done right, you better do it yourself.” In this case, I’m forcing the the session to terminate instead of relying on the servers to do it for me.

  3. 3 Rick

    Nothing like a good text editor and a capable programmer to get good, clean code. Leave it to Mircrosoft to write bad code for you — “I think I know what you meant and here’s a way to make it almost impossible to debug.” I’ve been away from programmnig for a while but I think the Visual series of programming tools have made programmers lazy. The flip side is that if you’re writing code for Windows, it may be the only way you can do it. But HTML is simple, why make it complicated?

    I’ve heard about that professor; truly evil she is. I think it was the WSU process that killed it for me. I think if I’d gone for MIS instead of CS, I would have been better off. Oh, well, it’s not like I’m gonna go back and finish it.

  1. 1 Cookie-licious at Penguin X-ing
  2. 2 Vicodin.
  3. 3 Drug soma.
  4. 4 Soma muscle relaxer.
  5. 5 Ambien on line.
  6. 6 Liquid valium.
  7. 7 Alprazolam online.
  8. 8 Soma drug testing.
  9. 9 Buy percocet online.
  10. 10 Hydrocodone.
  11. 11 Valium and also buy vicodin overnight shipping.
  12. 12 Order alprazolam.
  13. 13 Zolpidem without prescription.
  14. 14 Buy ativan fed ex no prescription.
  15. 15 Ephedrine.
  16. 16 Buy amoxicillin without prescription.
  17. 17 Oxycodone.
  18. 18 Cheap soma.
  19. 19 Lortab md cod.
  20. 20 Azithromycin 1g prescription.
  21. 21 Buy ambien 10.
  22. 22 Cheap zolpidem.
  23. 23 Cheap azithromycin.
  24. 24 Soma side effects.
  25. 25 Percocet no prescription.
  26. 26 Ambien buy.
  27. 27 Zolpidem without prescription.
  28. 28 Oxycontin withdrawal.
  29. 29 Buy soma online.
  30. 30 Ambien.
  31. 31 Buy oxycontin online.
  32. 32 Buy zolpidem.
  33. 33 Buy valium online without a prescription.
  34. 34 Buy percocet online no prescription.
  35. 35 Prescription medication side effects for soma.
  36. 36 Side effects norvasc.
  37. 37 Cipro.
  38. 38 Ambien cr addiction.
  39. 39 Soma fm.
  40. 40 Hydrocodone.
  41. 41 Elavil dosage.
  42. 42 Celebrex.
  43. 43 Can you take augmentin for a staff infection.
  44. 44 Chest pain with prilosec.
  45. 45 Celebrex.
  46. 46 Protonix.
  47. 47 Amaryl.
  48. 48 Flomax.
  49. 49 Celexa review.
  50. 50 Ventolin.
  51. 51 Elavilonline.
  52. 52 Retin a cream.
  53. 53 Amoxicillin rash infant.
  54. 54 Ativan half life.
  55. 55 Drug soma.
  56. 56 Buy vicodin online without prescription.
  57. 57 Meridia.
  58. 58 Duromine identification.
  59. 59 Ephedrine.
  60. 60 Zolpidem tartrate.
  61. 61 Levothyroxine abbreviated.
  62. 62 Nexium.
  63. 63 Online cooking videos.
  64. 64 Cooking time for a prime rib.
  65. 65 American indian cooking.
  66. 66 Is microwave cooking healthy.
  67. 67 Cooking recreational vacation classes.

Leave a Reply



Meta