RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Question about RunUO source...

Status
Not open for further replies.

xir

Wanderer
Magic Numbers is probably one of the big no-noes along with goto statements that one learns about when starting out with software engineering. In this case, however, it is probably best to let sleeping dogs lie as the damage/design decision has already been made.

Phantom said:
Lets not forget, every variable goes to the Stack\Heap, there are ALOT of clilic messages.

You would notice a HUGE performance decrease due to this fact, I don't even think modern computers could handle thousands upon thousands of static variabls within the Heap.

If you don't think it will make a difference, test your theory out

I would disagree on this point. I'm sure most modern compilers including the .NET C# compiler would use constant folding at compile time to substitute the magic numbers. There would be no performance hit at all at runtime.
 

Zippy

Razor Creator
I think this is a very long thread that doesn't matter very much at all.

The fact is, we already have the magic numbers, and removing them would take a very long time. As krrios said, the contant names what would follow would most likely decrease readability. We aren't talking about simple find and replace on a few numbers here, there are several thousands of cliloc numbers in UO, and the RunUO source+scripts is over 150,000 lines. Its not worth changing.

Also, Couragous, you seem like a smart guy. But do we need to hear about you being a software dev with 15 years of exp in every post?

I should start ending all of my posts with:
Software Engineer with 2+ years professional experience.
Creater of Razor (30,000 lines of C# and 5,000 lines of C++)
Legendary Hacker of Brasilian BotNets

Education:
Fall 2005 - Present
Master of Science, Computer Science
Expected Date of Graduation: May 2007 GPA: 3.5

Fall 2001 - May 2005
Bachelor of Science, Computer Science
Overall GPA 3.21, Computer Science GPA 3.63
 

Courageous

Wanderer
I think this is a very long thread that doesn't matter very much at all.

If any of the dozens of newbie programmers, first learning our art through the time-honored tradition of gaming learn NOT to do this, I'll count this a success, and think it mattered quite a bit.

As krrios said, the contant names what would follow would most likely decrease readability.

Yes, it's true that he said that.

C//

p.s., as an addendum, I've tried to be extremely careful with my criticism in this respect; I have read a great deal of the code, and appreciate not only the contribution to the community, but think the code is actually quite well written (particularly: well organized) in general.
 

Kamron

Knight
If you were elite enough, if you could code a visual studio plugin to take the integer argument from those methods, and allow you to click on it to open your own custom cliloc viewer and display the text equiv of it in the case that its not documented, that way you can add the comment.

In the terms of actually having the cliloc on hand in runtime, you can edit the Ultima.dll to load the cliloc.enu (and any language on top of it) so that you can reference it and translate the numbers. I believe the increase in memory as a hashtable is pretty harmless, probably around 2-3MB total for cliloc.enu alone.
 
Courageous said:
As a software engineer with a good 15 years of performance engineering under my belt, I totally disagree.

C//

O rly? Use that 15 years experience, find either UO Localization or Phenos' Cliloc Viewer, and use either application's search function whenever you run into these "magic numbers." Stop being so damn lazy.
 

Courageous

Wanderer
TheOutkastDev said:
O rly? Use that 15 years experience, find either UO Localization or Phenos' Cliloc Viewer, and use either application's search function whenever you run into these "magic numbers." Stop being so damn lazy.

The sentences you wrote do not follow from the matter you quoted. What "I do not agree upon" is that the use of local versus heap allocated variables in this case will have any observable run time impact on a server of the sort that RunUO is: one that spends a good deal of its life communicating packets to subscribed entities.

C//
 

Courageous

Wanderer
TMSTKSBK said:
Yah, well, your snobbiness isn't either.

(2 admin, 1 mod)

My opinion: phantom earned this little bit of "snobbiness", wherein his first messages to me he boldly and rudely asserted "you do not know what you are talking about," which he later backed off from in embarrassment by deleting his messages from the thread.

I have been unfailingly polite; while indeed, I will agree that I have been immodest, this is no cause for you to insult me. Such remarks will only reflect badly on you, proving without a doubt that you are an insulter, no matter whether or not the truth of your insult is in question by your audience or not.

You seem terribly ruffled that I am willing to state that I "disagree" on some subject or other. Disagreement is neither snobby nor insulting, it's just disagreement.

C//
 
Courageous said:
The sentences you wrote do not follow from the matter you quoted. What "I do not agree upon" is that the use of local versus heap allocated variables in this case will have any observable run time impact on a server of the sort that RunUO is: one that spends a good deal of its life communicating packets to subscribed entities.

C//

Do you not recall trying to justify the system with readability? I do... "The readable way also happens to have a mneumonic, and that allows developers to remember and type things that are, umm.... easy to remember."

As I said. Get a cliloc editor with a find feature. Look up the clilocs.

Your initial justification for redefining magic numbers has already been disproven. You stated "that any global changes to any of these special numbers has a single point of control...." OSI does not remove clilocs, nor take one and drastically alter its string representation.
 

Courageous

Wanderer
TheOutkastDev said:
Your initial justification for redefining magic numbers has already been disproven.

I don't agree that anything has been disproven, except the desire of the RunUO core team to do it, which is perfectly well their business.

While one member who put it a bit too bluntly in saying that this is a first-year software engineering "not to do list" thing, I do agree with him, on a wide variety of levels, except for perhaps the way it was put; I continue to remain puzzled as to why a project otherwise put together so professionally would allow this.

There is a term, used by technologists regarding some small negative point of a technology they otherwise love. They call it a "wart". I would call the use of magic numbers in the runuo core a wart, and personally think that if some volunteer would fix it, that would be a very good thing (and I recall someone volunteering).

Since you are recalling what I have said, I would like you to also recall that I have also said that magic numbers (why did you put scare quotes around this term?) are prevalent elsewhere in the code. Since I am finding them by accident, and without a search, I can only assume that the "don't use magic numbers" mantra is being ignored with the use of things other than cliloc.

Zippy and others are certainly correct that this thread has outlived any useful life. I can see clearly that whatever else is true I should have waited for a later day to attempt to provide this, or any, bit of constructive criticism...

C//
 

TMSTKSBK

Lord
Courageous said:
I don't agree that anything has been disproven

Snobbiness.QED

Dude...maybe you know tons. But give it up. All you've proven so far is that you've got an incredibly thick skull. Maybe that's an insult. I'd prefer to classify it as "constructive criticism" -- you need people to tell you these things :)



(I am not least in the thick-skull offenders...)
 

TMSTKSBK

Lord
I don't care about your disagreement. Disagree all you like. Takes all kinds, etc, etc. It's your TONE that irks me. This "I am the lord of all programming"-ish attitude has to go.

If you wish to implement this idea, feel free to do so. On whatever scale is required for your projects. But doing this for every cliloc, or even every major cliloc, is a rather large and pointless undertaking, from the view of the admins...and they're the only ones that count, in the long run.

I see the usefulness of this for a project. If you have a cliloc you use over and over, define it in a central file, and then use it wherever you need it. But the level of work required for this to be centralized goes somewhat beyond the benefit.

I like people. I like getting along with people. I really am a nice guy, most of the time. I don't like people that think they own the world. So if you just stop acting like you own the world, we can get along great :)

And I'm acting like a mod...so I better stop...
 
Status
Not open for further replies.
Top