|
I was and still am kinda new to them. How it was taught to me and I continued to learn was just the first letter and still use it.
|
|
|
|
|
I tend to use the first letter of the thing/object, or f for throwaways, or n & p for the next / previous ones.
|
|
|
|
|
cjb110 wrote: f for throwaways
Is that like q for cucumber?
|
|
|
|
|
Nope, it was a misunderstanding of the relationship between C# lambda and the maths.
I thought that the lambda represented the f, in f(x), not the x!
|
|
|
|
|
Lambda is a Greek letter, I don't speak/understand Greek
|
|
|
|
|
|
I always use the initial of the object type:
person => p
animal => a
etc..
|
|
|
|
|
Since lambdas come from lambda calculus and it is customary to say
f(x) such that x.Id == 2
or
x => x.Id == 2
And if I ever need a second variable it's y. If it's a word problem, then x = products, but the calculation is always done with the variable x.
Just a habit from math and/or maths class.
I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone - Bjarne Stroustrup
The world is going to laugh at you anyway, might as well crack the 1st joke!
My code has no bugs, it runs exactly as it was written.
|
|
|
|
|
Fully agree.
Lincoln Pires
modified 26-Aug-15 7:19am.
|
|
|
|
|
I don't even want to understand that product is legal identifier.
In my programs, I always use the x, funny thing, everyone uses x. Unless he has a rage against his keyboard.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Every now and then I throw in a z or a j, just to confuse the support guy
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I use Obj=>
My co-workers understand as it my signature.
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
|
Anything non-trivial gets spelled out; and often split into intermediates to assist in debugging. (No way to step into a chained lambda and with a bunch dotted together finding where something goes wrong is easier said than done.) Linq intermediates are also among the very few places I use var ; as debugger only values I don't normally care what the formal type def is, and in the expressions I want to have visibility to intermediates it's normally something godawfully gross anyway.
Really trivial ones I go back and forth on if it's adding information or just length. I'd probably do this:
Items.Select(product => product.ID);
verbosely, but use the short form for:
Products.Select(p => p.ID);
Since Products is normally sufficient to type it. I generally prefer the latter style because Products >> Items in overall readability.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Dan Neely wrote: Since Products is normally sufficient to type it. I generally prefer the latter style because Products >> Items in overall readability.
Now you're just confusing us, why would you want to shift Products right by Items bits?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
(MyMostExcellentLamdaExpressionVariableInTheWholeWorld => MyMostExcellentLamdaExpressionVariableInTheWholeWorld.Id)
|
|
|
|
|
Indeed, should've used camelCasing there...
(myMostExcellentLamdaExpressionVariableInTheWholeWorld => myMostExcellentLamdaExpressionVariableInTheWholeWorld.Id)
|
|
|
|
|
|
There's no point in saving a few keystrokes for no reason at all.
|
|
|
|
|
|
I agree. I like to write the minimum amount of code that is still readable and semantically unambiguous. Of course, I can't guarantee that everyone will agree but other devs usually find my code readable when they've expressed an opinion. Of course, it might still be deficient in other respects.
Kevin
|
|
|
|
|
Nor is there any reason to bog down the reader with needless detail.
|
|
|
|
|
Never said so. The best readability you get if it's short but descriptive.
|
|
|
|
|
One of our juniors whent a little overboard with his names and made them so long, descriptive and sometimes too similar that the code became absolutely unreadable.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
I learned to write "easy understandable and maintainable code" the hard way, because in my company is long term maintainance the normal case, so we have to understand the code in 10 or more years.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Could I read and understand this code at 3am after 10 cups of coffee.
Because one night you will be reading that code at 3am after 10 cups of coffee.
|
|
|
|