35
devbf
212d

After a long time just reading your posts, here's my first post:

Just for clarification: I'm studying electrical engineering in Germany. During your time at university, you have to work half a year as a intern to get some practical experience. So I'm in a position where I mainly have to say "yes" to work that is given to me. Also I'm working with a lot of PLC programmers, so I'm nearly the only one who programs non-PLC stuff at the department.

But now it's time for my rant (and also my most satisfying optimization ever). In the job interview for the internship, my task at the company was described as C# programmer. I only programmed C and Python before, but C# looked interesting and so I learned C# from ground up in the summer before the internship. I quite liked it and I was really happy on my first day of work. Then I was greeted with this message: "I know you are hired as C# programmer, but could you please look into this VBA program, it takes 55 seconds until it finishes its task and that's to slow". So I (midly angry because I had to do VBA and not C#) started the program and it was really horribly slow (it just created a table with certain contents from a very big imported symbol file). I then opened up the source code and immideately saw bad code. The guy who wrote it basically just clicked on the macro recording button and used the recorded mouse clicks in the source code. The code was like: Click on cell A1 -> copy cell A1 -> move to sheet XY -> click on cell A2 -> paste copied stuff and so on... I never 'programmed' in VBA before, so I used my knowledge of 'real' programming languages to do this task. After using some arrays and for-loops, which did not iterate over all the 1.000.000 unused cells after the last used one, the program took only 3 seconds after it finished the new table! Everybody was quite impressed, which led to much more VBA optimization... That was clearly not my goal haha :)

Comments
  • 2
    Moin and welcome to devRant!
  • 3
    Servus and thank you fellow german :)
  • 3
    @devbf Grüß Gott and Welcome! :D
  • 0
    @creep Habedere (bavarian for hello) and thank you :D
  • 1
    So scary how prevalent vba (and to a lesser extent vbs) still is in corporate environments nowadays. Guess some things will never change, unless MS somehow decides to fully drop support.
  • 0
    Yeah, I'm just going to apologize here. My previous post was a response to a completely different rant. No idea how it ended up here. Mea culpa :)
  • 1
    @krz1 the only point that VBA still exists is the fact that the average office Joe can write programmer as previous job in his CV :)
  • 0
    @sortoftested thought so, didn't seem to make sense :)
  • 0
    I call this a "backfired optimization"
Add Comment