1,324 reputation
428
bio website
location Bulgaria
age
visits member for 2 years, 8 months
seen 7 hours ago

2d
awarded  Nice Question
2d
comment When is it not acceptable to model physical world objects with classes?
Thanks for the point of view! Btw here, Fig.1 they talk about some concept of collaborations, with different collaborations (use cases) exposing different aspects of an object. I hope I understand that some day.
2d
accepted When is it not acceptable to model physical world objects with classes?
2d
revised When is it not acceptable to model physical world objects with classes?
added 179 characters in body
2d
revised When is it not acceptable to model physical world objects with classes?
added 10 characters in body
2d
comment When is it not acceptable to model physical world objects with classes?
@gnat, but the Question I quote at the top is unrelated to the quoted discussion below. How can I improve my question?
2d
comment Is this a good pattern: replacing a long function with a series of lambdas?
Thanks for explaining. I am a novice programmer and am now glad that I asked - before the habit had built up.
2d
comment Is this a good pattern: replacing a long function with a series of lambdas?
Thank you for the quick answer. I opened another question to address the elephant in the room.
2d
asked When is it not acceptable to model physical world objects with classes?
2d
accepted Is this a good pattern: replacing a long function with a series of lambdas?
Jan
27
awarded  Popular Question
Jan
27
comment Is this a good pattern: replacing a long function with a series of lambdas?
Great point. I see those as the few advantages of the approach with lambdas - (1)code locally adjacent and with local scope(this would be lost by file-level functions) (2)compiler ensures that no local variables are shared between code segments. So those advantages can be preserved by separating calculate() into {} blocks and declaring shared data at the calculate() scope. I thought that by seeing that the lambdas do not capture, a reader wouldn't be encumbered by the power of lambdas.
Jan
27
comment Is this a good pattern: replacing a long function with a series of lambdas?
@Kevin, the formulas for everything are given in the requirements. Code posted.
Jan
27
revised Is this a good pattern: replacing a long function with a series of lambdas?
added 1303 characters in body
Jan
27
comment Is this a good pattern: replacing a long function with a series of lambdas?
Sounds reasonable, but it is difficult for me to imagine the implementation. File-scope class with static methods? Class, defined inside A (maybe even functor with all other methods private)? Class declared and defined inside calculate() (this looks very much like my lambda example). As a clarification, calculate() is one of a family of methods (calculate_1(), calculate_2() etc.) of which all are simple, just this one is 2 screens of formulas.
Jan
27
comment Is this a good pattern: replacing a long function with a series of lambdas?
@Blrfl, encapsulation - no one but calculate() will know about those sub-functions.
Jan
27
asked Is this a good pattern: replacing a long function with a series of lambdas?
Nov
13
answered Should we add constructors to structs
Nov
6
comment Why do we use non-descriptive internal codenames?
So many answers, and yet, if you ask the question "Should I be naming my servers by purpose or by greek gods?", I suspect/hope purpose will be advised. And yes, fileserver4 is easier to remember than Aphrodita, when it comes to remembering which are the servers with ftp.
Nov
4
revised How to avoid long call chains?
edited tags