Forum Discussion
JavierCollRodri
13 years agoContributor
Hi Grant,
It's a big problem you are facing. I've been working for too much time this way, and it is really hard. The worst of it, it is a waste of time (my opinion), because as the code grows and sprints go away, you will be more time maintaining your code than developing new one (it's a fact, I'm so sorry)
But the world is that way and there is no justice at all, so let's see what we can do. I'm using JavaScript and I don't know much about VB, so you will have to adapt it to your own code (sorry again)
First, we create an array of properties and values for an object. For example:
Now, you can search for that object by using a function like that:
This will create an array of properties and values. You can use those arrays to search for the object. The point is that you can change the variable loginLink that way:
And you will only have to worry to change it once, in one place. No need to seek for it on all your code.
I don't know how to implement it on VB, but I hope there is a way.
Have luck!
It's a big problem you are facing. I've been working for too much time this way, and it is really hard. The worst of it, it is a waste of time (my opinion), because as the code grows and sprints go away, you will be more time maintaining your code than developing new one (it's a fact, I'm so sorry)
But the world is that way and there is no justice at all, so let's see what we can do. I'm using JavaScript and I don't know much about VB, so you will have to adapt it to your own code (sorry again)
First, we create an array of properties and values for an object. For example:
var loginLink = {
"ObjectType": "Link",
"innerText": "Login",
"idStr": "login_link"
}
Now, you can search for that object by using a function like that:
function parseObjectInfoToArray(objectInfo)
{
var object = new Object();
var aProp = new Array();
var aVal = new Array();
var i = 0;
for ( e in objectInfo ) {
aProp = e;
aVal = objectInfo;
i++;
}
return new Array(aProp, aVal);
}
This will create an array of properties and values. You can use those arrays to search for the object. The point is that you can change the variable loginLink that way:
var loginLink = {
"ObjectType": "TextNode",
"idStr": "login_link",
"className": "login-link"
}
And you will only have to worry to change it once, in one place. No need to seek for it on all your code.
I don't know how to implement it on VB, but I hope there is a way.
Have luck!