One of the Best Bits of Programming Advice I ever Got
51–60 of 94 posts
Re: One of the Best Bits of Programming Advice I ever Got
#52Re: One of the Best Bits of Programming Advice I ever Got
#53Earlier quoted context omitted.
A simple counter that can be manipulated with two buttons "Up" or "Down": https://github.com/HeinrichApfelmus/reactive-banana/blob/mas... main = start $ do f counter] actuate network This doesn't look like good UI code to me. It seems to use too many advanced FP concepts that have nothing to do with the task at hand. Are you sure this is better than the OO approach? Why?
This doesn't look like good UI code to me. It replaces a mutable counter (that could potentially be changed anywhere in the program) by a definition of the counter that describes all possible changes it can have during its lifetime: counter = accumD 0 $ ((+1) So, we have a counter that has an initial value of one. Over time, 1 can be added and 1 can be subtracted, namely when repsectively an eup or edown event occurs…
Re: One of the Best Bits of Programming Advice I ever Got
#54Amazing how small linguistic changes can cause large semantic shifts. Comparable to the post's rule: in English, a few rules I've picked up are - avoid words ending in "ly" (suffix weakens concepts; suggestion from Stephen King) - never start a sentence with "I" and otherwise minimize its use - "but" negates everything that came before - avoid "to be" Any other such suggestions, in natural or artificial languages?
And people so often substitute longer words, (e.g. 'myself' instead of 'me') when they want to sound professional.
"I hit myself" => OK "Please contact myself" => WRONG.
Re: One of the Best Bits of Programming Advice I ever Got
#55http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...
Re: One of the Best Bits of Programming Advice I ever Got
#56I generally accept the point made in the article, but what should I use in place of "Controller"? If using MVC I generally call it "ApplicationController" or "SimpleController". Should it be "Application", "ApplicationControl"...?
We were just discussing this yesterday: http://news.ycombinator.com/item?id=3036153.
A favorite principle: when you can't find a good name for something, it's often a sign that the concept you're trying to name isn't appropriate.
Re: One of the Best Bits of Programming Advice I ever Got
#57Amazing how small linguistic changes can cause large semantic shifts. Comparable to the post's rule: in English, a few rules I've picked up are - avoid words ending in "ly" (suffix weakens concepts; suggestion from Stephen King) - never start a sentence with "I" and otherwise minimize its use - "but" negates everything that came before - avoid "to be" Any other such suggestions, in natural or artificial languages?
Is there a collection of suggestions from Stephen King? I love picking up small pieces of advice from respectable writers, and he is undoubtedly one of them.
Re: One of the Best Bits of Programming Advice I ever Got
#58Earlier quoted context omitted.
what do the controllers actually do? Synchronize state? Verify that constraints are met?
You're suggesting I call them "StateSynchronizer" or "ConstraintVerifier"?
If I'm looking at the components of the software, and I want some code to do X, or wonder what a class Y does, what does "Controller" tell me?
If you're doing constraint verification (for example), my preference is to have a container (e.g. vector) of Constraint and just run find_if() to see when Constraint::Valid(environment) returns false. Then it's a class called ConstraintVerificationUtil and it has a single static method: VerifyList.
Re: One of the Best Bits of Programming Advice I ever Got
#59I generally accept the point made in the article, but what should I use in place of "Controller"? If using MVC I generally call it "ApplicationController" or "SimpleController". Should it be "Application", "ApplicationControl"...?
From the OP: "The fact that every single MVC implementation in the world has had a different role for Controller ought to tell us something about how well that idea fit." We were just discussing this yesterday: http://news.ycombinator.com/item?id=3036153 . A favorite principle: when you can't find a good name for something, it's often a sign that the concept you're trying to name isn't appropriate.
I certainly don't want event handling code all over the application just because this means I can then have noun-only classes?
Re: One of the Best Bits of Programming Advice I ever Got
#60Earlier quoted context omitted.
You're suggesting I call them "StateSynchronizer" or "ConstraintVerifier"?
No, I suggest you name it after what it actually does. "Controller" is a role that's only defined in terms of what it interacts with. It's essentially a declaration of rank with other types; it doesn't say anything about what functionality the class provides. If I'm looking at the components of the software, and I want some code to do X, or wonder what a class Y does, what does "Controller" tell me? If you're doing c…