... WHY?!
-
I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:
if (Session["tWidth"] != null)
{
htmlToImageConverter.BrowserWidth = int.Parse("1025");}
I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
-
I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:
if (Session["tWidth"] != null)
{
htmlToImageConverter.BrowserWidth = int.Parse("1025");}
I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
And what is the tWidth for? Is it an integer? Or just some random value?
Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
-
And what is the tWidth for? Is it an integer? Or just some random value?
Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
I had a difficult time understanding that as well. 'tWidth' is, in fact, an integer. In other places throughout the project it's used to store the width of certain widgets in a report. But this particular statement, I have no idea. That's literally all the code in it. It never references 'tWidth' in this particular section. *smh* There are a ton of bad practices in this project. A lot of empty 'catch' statements after a large 'try' block and so forth. Almost *ZERO* comments. Blah, blah, blah. :(
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
-
I had a difficult time understanding that as well. 'tWidth' is, in fact, an integer. In other places throughout the project it's used to store the width of certain widgets in a report. But this particular statement, I have no idea. That's literally all the code in it. It never references 'tWidth' in this particular section. *smh* There are a ton of bad practices in this project. A lot of empty 'catch' statements after a large 'try' block and so forth. Almost *ZERO* comments. Blah, blah, blah. :(
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
X|
Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
-
I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:
if (Session["tWidth"] != null)
{
htmlToImageConverter.BrowserWidth = int.Parse("1025");}
I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace
temporarily
htmlToImageConverter.BrowserWidth = int.Parse(tWidth);
by
htmlToImageConverter.BrowserWidth = int.Parse("1025");
But then forgot to change it back. And nobody complained till you happened to find that WTF...
-
The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace
temporarily
htmlToImageConverter.BrowserWidth = int.Parse(tWidth);
by
htmlToImageConverter.BrowserWidth = int.Parse("1025");
But then forgot to change it back. And nobody complained till you happened to find that WTF...
-
The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace
temporarily
htmlToImageConverter.BrowserWidth = int.Parse(tWidth);
by
htmlToImageConverter.BrowserWidth = int.Parse("1025");
But then forgot to change it back. And nobody complained till you happened to find that WTF...
That's a very reasonable observation, and you're probably quite right. Thank you for that. Now I'm going to put "tWidth" back in there and see if it fixes some of these problems. Haha.
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
-
That's a very reasonable observation, and you're probably quite right. Thank you for that. Now I'm going to put "tWidth" back in there and see if it fixes some of these problems. Haha.
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
Be careful! It might introduce a new defect now - do you know how many later changes assume that that WTF is the correct solution? :)
-
Be careful! It might introduce a new defect now - do you know how many later changes assume that that WTF is the correct solution? :)
-
I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:
if (Session["tWidth"] != null)
{
htmlToImageConverter.BrowserWidth = int.Parse("1025");}
I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
that's easy to fix, just change it to: int.Parse(int.Parse("1025").ToString());
-
that's easy to fix, just change it to: int.Parse(int.Parse("1025").ToString());
-
Haha. I changed it and it didn't make any difference whatsoever. ;-P
djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.
You lack experience with such WTF code! In some two or three years, a customer will complain about a page being too wide or too narrow... And then the new guy working on the project will submit your little change as a WTF: a useless change introducing a new bug. That's how such WTF code works...
-
You lack experience with such WTF code! In some two or three years, a customer will complain about a page being too wide or too narrow... And then the new guy working on the project will submit your little change as a WTF: a useless change introducing a new bug. That's how such WTF code works...
-
And what is the tWidth for? Is it an integer? Or just some random value?
Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
It may be for those special people with a 1025 x 768½ screen resolution?
-
The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace
temporarily
htmlToImageConverter.BrowserWidth = int.Parse(tWidth);
by
htmlToImageConverter.BrowserWidth = int.Parse("1025");
But then forgot to change it back. And nobody complained till you happened to find that WTF...
Bernhard Hiller wrote:
and a developer decided to replace
temporarily
You seem to know about it very well. I can almost pinpoint who that was. :laugh:
Signature construction in progress. Sorry for the inconvenience.
Damn you have the perfect signature - CBadger
-
Bernhard Hiller wrote:
and a developer decided to replace
temporarily
You seem to know about it very well. I can almost pinpoint who that was. :laugh:
Signature construction in progress. Sorry for the inconvenience.
Damn you have the perfect signature - CBadger
Oh dear, I'd better use a different login name for such posts...