Are you good at Maths?

Damocles, I won't bother replying to your post points as I don't think we'll get anywhere going back around again. I accept your point of view that a comment is a suitable replacement for variable name in certain circumstances. I don't agree with it, but neither of us will get anywhere flogging that horse.
 
simmers said:
A_51g5zCIAEHXQI.jpg


320..
 
I changed my mind...

Damocles said:
Not a fair question really as it depends on the circumstance. I would do whichever would benefit the most. You can make the argument that any function that needs to have a number of complex calcuations in a series of loops is badly designed and needs a rewrite anyway. If I just had to change an index variable name to make it clear, I would obviously do this.
Fair enough. I always work within a specific convention, so if I name everything in a specific way.

Damocles said:
//i = age, j = grumpiness
Fair enough, I disagree that this is effective enough though.

Damocles said:
Disagree. If you have some functions that are hundreds of lines with multiple loops, you need to rethink the design of the section. I know it happens on codebases over years as programmers and requirements change but we are arguing a perfect world scenario here.
For the project I'm currently working we have some highly optimised algorithms, the functions for which cover several hundred lines. It wouldn't be appropriate to subdivide these into further functions as there aren't any appropriate subdivisions to be made. We also have some legal restrictions on how certain calculations have to be made. That said, I was using the 200 figure simply to give a number that would entail scrolling. If I had to scroll or click something to find out what a variable was supposed to do I'd want it renamed so I didn't have to.

Damocles said:
Agree but here we go back to my earlier point. Also, a combination of a decent debugger and IDE will solve this problem. Right click->Find Definition.
The problem with this is that if, say, you performed three loops one after the other i would have a different meaning depending on which loop it was in. You'd have to keep checking which loop you were in or checking your definition again. We develop our code to be easily human-readable, in that you can work out what it does just by reading it like a book with no knowledge other than an understanding of the syntax.

Damocles said:
These scripts are literally useless. One of the most basic ideas about commenting is that it should describe what the code is doing and not describe the code itself. Saying

Code:
//remove bottle from wall

for(int i=0;i <10;++i)
{
     Wall.RemoveBottle(i);
}

is literally the most useless thing you can say. It is self evidence that a call to RemoveBottle will remove a bottle.

The self producing documentation should only be used as an addition to a decent commenting system, not as a replacement for it.
I agree, and we comment the code too. These comments also pull through into the documentation. The automated documentation is simply the bones around which the final code documentation is produced.

Damocles said:
I agree when we're talking about the naming of classes, objects, functions, and variables which have large scope. But we're talking about variables that have local scope to the loop and disappear after. If you're writing nested loops where it isn't obvious what i and j are doing, it is your method names and commenting you need to work on; naming the index variables is putting a plaster on a broken knee.
I disagree that there should be any distinction between the two. A variable is a variable regardless of scope and should be named per your variable naming convention. Ours is scope (global, module-level, etc.), type (bln, int, str, etc.) then name, i.e. strName or gblnReadOnly. This applies to every variable that is defined.

I don't agree that losing track of the meaning of i and j means the method names and comments need improving. Where possible you break down functionality into it's component functions, but there comes a point when it can't be broken down any further. That point isn't always the point at which each function does only one thing as there are often scenarios where multiple things are intertwined and need to be performed together in such a way that breaking it down into separate functions would actually increase complexity.

Your answer to that will probably be along the lines of "well if the code became too complex I would use more descriptive names instead of just i or j", though feel free to disagree if it wouldn't be as I don't want to speak for you. Therein lies the difference in our opinions, as mine is that I would rather it be done the same way throughout so that we know everyone's expectations and understandings will align. With multiple developers it would be difficult to ensure that the line at which you stopped using i and j was one that all found suitable as one developer might think a particular block of code was more complex than someone else thought it was.
 
Irwell said:
For the project I'm currently working we have some highly optimised algorithms, the functions for which cover several hundred lines. It wouldn't be appropriate to subdivide these into further functions as there aren't any appropriate subdivisions to be made. We also have some legal restrictions on how certain calculations have to be made. That said, I was using the 200 figure simply to give a number that would entail scrolling. If I had to scroll or click something to find out what a variable was supposed to do I'd want it renamed so I didn't have to.

If the for loop covers a lot of code, i would obviously name the variables i am iterating over on a more readable way. Nobody is arguing against that. My comment was relating to 3d positions and vectors, and if my code is doing any such computations using i,j,k in my for loops makes perfect sense.

I follow coding standards to the dot, even ones i hate. My policies when it comes to coding is code is written ones but reread many times. But in the context of my comment using i,j,k is very descriptive.
 
Irwell said:
For the project I'm currently working we have some highly optimised algorithms, the functions for which cover several hundred lines. It wouldn't be appropriate to subdivide these into further functions as there aren't any appropriate subdivisions to be made. We also have some legal restrictions on how certain calculations have to be made. That said, I was using the 200 figure simply to give a number that would entail scrolling. If I had to scroll or click something to find out what a variable was supposed to do I'd want it renamed so I didn't have to.

To be honest now you've described the project's size, it's a little clearer why you would have functions with loops moving into the several hundred line mark.

The problem with this is that if, say, you performed three loops one after the other i would have a different meaning depending on which loop it was in. You'd have to keep checking which loop you were in or checking your definition again. We develop our code to be easily human-readable, in that you can work out what it does just by reading it like a book with no knowledge other than an understanding of the syntax.

True, and those are the cases whereby index variable naming is a logical thing to do. I think we're arguing from different scopes here and trying to apply a universal rule. You're arguing from the several million line project ideal where I'm arguing from the run of the mill project ideal. Like anything else, you adjust to suit. I'm sure that if you had a single loop somewhere, maybe iterating through a connection array or something trivial, you wouldn't tick up a fuss for int i?

I agree, and we comment the code too. These comments also pull through into the documentation. The automated documentation is simply the bones around which the final code documentation is produced.

The JavaDoc/Doxygen style is something that I do find attractive and has lots of uses for. Like anything though, it has to actually be used well otherwise it detracts rather than adds to understanding. Do you guys legislate on commenting at all?

I disagree that there should be any distinction between the two. A variable is a variable regardless of scope and should be named per your variable naming convention. Ours is scope (global, module-level, etc.), type (bln, int, str, etc.) then name, i.e. strName or gblnReadOnly. This applies to every variable that is defined.

I tend to "think" in Linux naming conventions originating from C as that's what I learnt with. So for me, I would use things like count_online_users() rather than iCntOnUsers()

To quote Linus here on the kernel naming conventions:

C is a Spartan language, and so should your naming be. Unlike Modula-2
and Pascal programmers, C programmers do not use cute names like
ThisVariableIsATemporaryCounter. A C programmer would call that
variable "tmp", which is much easier to write, and not the least more
difficult to understand.

LOCAL variable names should be short, and to the point. If you have
some random integer loop counter, it should probably be called "i".
Calling it "loop_counter" is non-productive, if there is no chance of it
being mis-understood. Similarly, "tmp" can be just about any type of
variable that is used to hold a temporary value.


I don't agree that losing track of the meaning of i and j means the method names and comments need improving. Where possible you break down functionality into it's component functions, but there comes a point when it can't be broken down any further. That point isn't always the point at which each function does only one thing as there are often scenarios where multiple things are intertwined and need to be performed together in such a way that breaking it down into separate functions would actually increase complexity.

Your answer to that will probably be along the lines of "well if the code became too complex I would use more descriptive names instead of just i or j", though feel free to disagree if it wouldn't be as I don't want to speak for you. Therein lies the difference in our opinions, as mine is that I would rather it be done the same way throughout so that we know everyone's expectations and understandings will align. With multiple developers it would be difficult to ensure that the line at which you stopped using i and j was one that all found suitable as one developer might think a particular block of code was more complex than someone else thought it was.

I think our thoughts are different because you're a project manager and I'm a developer. I expect other developers to understand my code simply because anybody who has coded for more than a few minutes (and some that haven't) can probably work out what "tmp" mean in the context of the overall. You don't have the luxury of presumption and when that new hire who didn't quite tell the truth about his experience bombs an entire module because of it, it's you who gets shouted at and not me.
 
Irwell said:
Sorry if I've missed any points here, I've tried to pick out your comments from mine.

pauldominic said:
You appear to be project manager and think of it as yours.
Irwell said:
Yes, my pet. It's what you do with projects.

Ok fair enough.

pauldominic said:
The project is at least 5 years old. This isn't a good sign.
Irwell said:
Yes, we handle the whole product lifecycle for the client, from design to decommission.

From the way you describe the project scale and complexity, its right up there with JSF/Future Carrier, Typhoon/Typhoon Infrastructure at RAF Coningsby and Nimrod.

This could be interpreted as a sign of hope or despair.

5 years is entirely reasonable in this circumstance.


pauldominic said:
Initially I thought you were also doing the conceptual design as well as being project manager. I hope this isn't the case.
Irwell said:
Several hundred people work on this project in different capacities. There are a number of people with a design authority role for different aspects of the system.

That's a very good sign. I presume they're Architects and they have a Chief Architect who is responsible for delivery of the overall solution.

pauldominic said:
Large scale developments should not be using extremely strict coding standards.
Irwell said:
I disagree, it would be impossible to do so without. This isn't just something that is my preference, though I agree with it myself, it's actually something dictated by both my employer and the client. I won't go into the reasons for client input on coding standards, suffice to say there is a reason.

Diktat does not mean to say that a policy is correct. As a Roman Catholic I am very aware of this.

Coding standards or more preferably coding guidelines are good practice. The issue is the extreme strictness and policing of the policy.

I'm starting to think the Vatican is involved in some way and the project health rating has just nosedived.


pauldominic said:
Code does not document itself.
Irwell said:
If you are a decent programmer then it does. I wouldn't hire someone whose portfolio indicated they weren't capable of this.

If programmers only get involved when provided with mature object models, the job is over 80% done. Code generation tools will even generate the classes, attributes and methods automatically from the design.

In between an extremely strict coding standards policy and the provision of object models from architects, I'm not sure how much freedom to manoeuvre they have and essentially Damo is right.

If you're project manager with involvement in HR and solution creation, you must be a significant risk and monitoring/reviewing yourself in the risk register.


pauldominic said:
Clients are not the same as Customers and there appears to be no understanding of who the Customer is.
Irwell said:
I'm well aware of who the customer is. I won't go into details on this, however, for obvious reasons.

Yes but is the Client (probably organisation) the same as the Customer (also probably organisation).

I hope they are!


pauldominic said:
Manual documentation of the Customer Requirements Definition, Requirements Analysis and Project Design is vital and essential.
Irwell said:
Yes, I agree it is. We also generally automate the creation basic application structure from the requirements documentation. Code documentation, however, is something that is mostly automatically documented and self-documenting

Ok.

pauldominic said:
The overall solution has thousands of classes and millions of lines of code. Also not a good sign.
Irwell said:
It's the nature of the project, one of the largest IT software projects in Europe over the last decade. I won't tell you exactly which number as you'd be able to work out which project it is. The reason for the number of classes and lines of code is the sheer complexity of the functionality.

Ok and I have a few suspicions.

pauldominic said:
The project is a bespoke solution where the design authority lies with the client. This means that all the investment and engineering costs can't be transferred to a manufacturing run and have to be born by the business rather than paying customers.
Irwell said:
I'm not sure how you work that out. Where design authority lies with the client they obviously take on some of the development risk as any error in the design is theirs.

It's standard business practice to transfer all the non recurring costs onto a mass manufacturing run.
e.g. Cars.

pauldominic said:
The developers should be fundamentally involved in translating the business logic into an analysis and design rather than developing the business logic which by now should be almost set in concrete.
Irwell said:
The logic is entirely set in concrete. If the logic is wrong then we head back to the requirements stage and the client pays for an alteration to the design. We have architects who are responsible for translating the requirements into a suitable object model. The programmers are then responsible for implementing this object model and the functionality it exposes.

See my comments above in part. Returning to requirements definition phase and changing the business logic would add mindboggling levels of extra cost.

pauldominic said:
The software development lifecycle has 6 subdivisions. I have no idea what you mean here.
Irwell said:
Damocles was right, I meant the waterfall model. That said, we use a hybrid of the waterfall model and RAD.

Ok - Waterfall is a necessary evil in projects such as these.

pauldominic said:
The sub-divisions can often be combined but its normally a cost based compromise. Changing the project methodology in the name of cost saving mid project adds extra risk and complexity and rarely saves any money at all. Cost increases are far more likely and common.
Irwell said:
I've never said we do that though. We have a set methodology which is closest to the waterfall model, but with elements from RAD at the design/development phases. The reason I mentioned that they can be combined as a cost-saving compromise is because of a statement you made about development methodologies.

Fair point although you'll never convince me that a WBS involving Architects and Programmers is better than one using a hierarchy of Systems and Software Engineers at different levels of the System Architecture.
 
Damocles said:
The software development lifecycle has 6 subdivisions. I have no idea what you mean here.

I may be mistaken but I think he's talking about the waterfall model

[bigimg]http://www.buzzle.com/img/articleImages/53717-5.jpg[/bigimg]

Ok cheers Damo. 6 phases rather than 6 subdivisions.
 

Don't have an account? Register now and see fewer ads!

SIGN UP
Back
Top
  AdBlock Detected
Bluemoon relies on advertising to pay our hosting fees. Please support the site by disabling your ad blocking software to help keep the forum sustainable. Thanks.