Click here to Skip to main content
15,886,689 members

Survey Results

Do you feel pressure to make your code look as good as code posted by experts?

Survey period: 24 Feb 2020 to 2 Mar 2020

Do you see really well written code and think "I should write code that good"?

OptionVotes% 
I put pressure on myself to write the best code I can29836.12
Yes, I feel pressure to write code that's as good as what you see online698.36
Sometimes, maybe, depends on the situation16419.88
No, not really20624.97
My code is already better than anything I see online8810.67



 
GeneralI reject the premise of the question Pin
PIEBALDconsult28-Feb-20 15:26
mvePIEBALDconsult28-Feb-20 15:26 
GeneralDo you feel pressure to make good polls? Pin
Marbry Hardin28-Feb-20 8:23
Marbry Hardin28-Feb-20 8:23 
GeneralPosting code online makes me an expert? Pin
GKP199227-Feb-20 18:18
professionalGKP199227-Feb-20 18:18 
GeneralMost of the code I see online isn't that good Pin
Dominic Burford26-Feb-20 4:22
professionalDominic Burford26-Feb-20 4:22 
GeneralRe: Most of the code I see online isn't that good Pin
John R. Shaw26-Feb-20 21:03
John R. Shaw26-Feb-20 21:03 
GeneralOptions aren't mutually exclusive Pin
agolddog25-Feb-20 10:01
agolddog25-Feb-20 10:01 
GeneralRe: Options aren't mutually exclusive Pin
John R. Shaw26-Feb-20 22:28
John R. Shaw26-Feb-20 22:28 
GeneralPsychopath Pin
BryanFazekas25-Feb-20 7:16
BryanFazekas25-Feb-20 7:16 
GeneralRe: Psychopath Pin
John R. Shaw26-Feb-20 21:01
John R. Shaw26-Feb-20 21:01 
GeneralFashions Pin
kalberts24-Feb-20 23:08
kalberts24-Feb-20 23:08 
GeneralRe: Fashions Pin
John R. Shaw25-Feb-20 0:57
John R. Shaw25-Feb-20 0:57 
GeneralRe: Fashions Pin
kalberts25-Feb-20 3:35
kalberts25-Feb-20 3:35 
John R. Shaw wrote:
I consider design and coding to be intricately linked; unless you are doing a very detailed functional design using flow charts, in which case the coders role is very limited.
From when I was working with protocols of the well-designed kind (read: OSI), I have had loved state/event driven models. However, most state model implementations are a crow's nest of if-elsesif or nested case statements; I never saw a framework for development of table driven code. So I started making my own ... but I switched jobs, and the whole thing was put in the drawer. Last Christmas, I found my 20+ years old design documents, brushed them up quite a bit, and my current hobby project is to complete that framework.

You are right: The coders' role is significantly reduced when a major part of the logic is put into a transition table, which defines a major part of the error handling as well - anything related to sequencing / protocol errors (which makes up a major part of runtime errors). A program code fragment handles a valid transition, and errors caused during that one transition. Transitions are by definition non-blocking and atomic, so any timing problems (race conditions etc.) are handled at the design level, reflected in the table, not in the the code. There is no other input than events; no intermediate input can scause an error during the transition. The transition logic itself (determining the next state, and for complex models: handling a set of substate variables) is handled by a common driver function (and for models with substates: Isolated bool functions on the substate variables). So the code is dramatically reduced both in size and complexity compared to other implementation methods. Essential complexity is moved into the transition table.

In my table framework, the tables are programming language independent. An editor manages the table of states, table of events, the transition table (states x events), table of event data types, as well as supporting tables for e.g. presentation styles. A state transition may call for actions such as raising events in other entities (objects). This code fragment may be specified in several languages; during the design, you may start out with a pseudocode description that any other language specification can be based on (but note that the code fragment, whether pseudo, K&R C, C#, Kotlin, ... handles actions for this single transition only).

Writing a generator to add all the required code blurb, extracting the appropriate code fragments from the tables, adding function headers, module definitions etc. is a one-time-task, and turns out to be quite simple. Obviously, the generator also provides a language specific driver for the transition table; this is really simple code that contains no application logic. From the tables the generator produces a set of source code files that may be fed into any compiler for the chosen language, complete with all red tape, and with definitions of required run time tables (e.g. the transition table, usually in a compacted form - tables of events and states usually have noe run time representation).

I haven't yet come as far as from a single table set generate implmentations in two different languages, having them cooperate over a communication channel; that will come some time this spring. When you then see how little the coder has to do, e.g. to create an implmenetation in a different language, you will see that indeed, the coders' role is reduced quite a bit. The major development work is in getting the transition table right.

Certainly: Designing software as atomic, instantaneous and non-blocking transitions requires a different approach than seeing objects as continously running processes. In may ways it is like going from GOTO-programming (or assembly JMP-instructions) to structured goto-less coding with for- and while-loops. Once you learn goto-less code, you love structured flow mechanisms. Once you learn to design flow logic, error handling and structure of cooperating entities as states and events, completely independent of language specific coding mechanisms, you learn to love that as well. In particular with respect to error handling.
GeneralRe: Fashions Pin
John R. Shaw26-Feb-20 4:09
John R. Shaw26-Feb-20 4:09 
GeneralRe: Fashions Pin
kalberts26-Feb-20 5:16
kalberts26-Feb-20 5:16 
GeneralRe: Fashions Pin
John R. Shaw26-Feb-20 20:40
John R. Shaw26-Feb-20 20:40 
GeneralNot at all Pin
super24-Feb-20 21:58
professionalsuper24-Feb-20 21:58 
GeneralRe: Not at all Pin
John R. Shaw26-Feb-20 21:23
John R. Shaw26-Feb-20 21:23 
GeneralOne more option Pin
Amarnath S24-Feb-20 17:36
professionalAmarnath S24-Feb-20 17:36 
GeneralRe: One more option Pin
John R. Shaw26-Feb-20 21:55
John R. Shaw26-Feb-20 21:55 
GeneralExperts? Pin
Rick York24-Feb-20 10:01
mveRick York24-Feb-20 10:01 
GeneralRe: Experts? Pin
John R. Shaw25-Feb-20 0:30
John R. Shaw25-Feb-20 0:30 
GeneralRe: Experts? Pin
Slacker00725-Feb-20 4:32
professionalSlacker00725-Feb-20 4:32 
GeneralRe: Experts? Pin
maze325-Feb-20 2:34
professionalmaze325-Feb-20 2:34 
GeneralRe: Experts? Pin
Nelek25-Feb-20 9:05
protectorNelek25-Feb-20 9:05 
GeneralIf I'm my own expert... Pin
Marc Clifton24-Feb-20 3:27
mvaMarc Clifton24-Feb-20 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.