Fork me on GitHub
#other-languages
<
2020-08-27
>
souenzzo14:08:51

@porkostomus When you say "C# but I'm generating the code with Clojure" you are doing something like (println "class %s { method %s(..)}" ...) them commit that C# code?

Bobbi Towers16:08:40

It's actually way less general and much more naive than that. For example, this form has over 1500 fields and each one has its own event handler like this:

private void textbox1_Click(object sender, EventArgs e)
{
    MyEventHandler("dbtable", "dbcolumn", MyField.Text, OtherInfo.Text);
}
Now all my sensibilities tell me that this should not be necessary, there should just be a single event handler that updates the db based on the name of the field that called it. But this is the way my client wrote it and I haven't learned enough C# to know how to refactor it. It's rather embarrassing, actually 😜. I should probably just stop this nonsense and learn how, but in the meantime if I'm stuck writing 1500 event handlers, it's easy enough to take the list of fields and feed it to a Clojure program that outputs them for me. I then paste the output into the app, which takes me about 5 minutes, and meanwhile my employer thinks I actually sat there for 2 hours typing them all up. Apologies if you assumed I was doing something more interesting...