|
Yes.
Many years ago, in C, I used a short to hold two characters for some text file parsing I needed to do.
modified 4-Jul-17 13:50pm.
|
|
|
|
|
PIEBALDconsult wrote: Then, to get the textual representation of the state
It's a flagged enum, so how would he represent the state Alarm | Malfunction ?
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Well spotted.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Bernhard Hiller wrote: store that value in a database eventually.
Did I miss important new trend in databases? When did they stopped supporting integers?
|
|
|
|
|
Looking at "QA" they also seem to have dropped support for dates.
|
|
|
|
|
It's worse than that: based on QA, they've also dropped support for parameterized queries!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It is even worst than that, based on the QA they have also dropped support for brains
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Bernhard Hiller wrote: with some 25+ years of experience in software engineering
var experience = EventType.None | EventType.Alarm | EventType.Malfunction;
Marc
Latest Article - Create a Dockerized Python Fiddle Web App
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Experience is the ability to recognize a mistake when you repeat it.
|
|
|
|
|
It makes no sense:
1 - There are combinations not covered by the encoder. ie Alarm | Malfunction
2 - It only makes sense to encode it if whatever is using does not support integers (or maybe it's meant to have a meaningful representation on a digital display, still what if it's alarming and malfunctioning).
3 - Should have used enum's HasFlag method.
Now, an expert in C# and 25+ years in programming could only do this if he's hung over, lazy, dumb or having an idea so bright nobody can understand.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
First, assume a legacy database schema...
|
|
|
|
|
Fabio Franco wrote: could only do this if he's pissed-off at legacy crap.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Bernhard Hiller wrote: So he translates an enum with a Flags attribute to a string , ignoring the fact that they are flags, in order to store that value in a database eventually.
I learned decades ago that its a fool errand to insult the previous developer(s), especially if one was not there participating in the decision making process. There are a multitude of factors and/or external forces that impact decisions like this and arrogantly criticizing these choices accomplishes little.
|
|
|
|
|
|
Especially knowing that I am also a previous developer to someone else.
|
|
|
|
|
thund3rstruck wrote: I learned decades ago that its a fool errand to insult the previous developer(s), especially if one was not there participating in the decision making process. There are a multitude of factors and/or external forces that impact decisions like this and arrogantly criticizing these choices accomplishes little. I agree with you.
I know the guy who wrote that code, and the circumstances: it's fresh code written this week.
Some time ago, I discussed with him his obsession of encoding everything in magical ints or one-letter-strings, sometimes also providing "endode"/"decode" functions for converting between the magical ints and the one-letter-strings and the other way round...
|
|
|
|
|
Ignore my previous post.
I used to work with someone like that. He no longer works here. Smart guy, very capable, but continuously made "mistakes" like that. His "code" has caused us lots of grief.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Bernhard Hiller wrote: ignoring the fact that they are flags It could have been changed to [Flags] after-the-fact and this code was just not updated.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
I was just browsing doing some rnd ... for a personal learning project.. the amount of JavaScript frameworks
google search is turning up is overwhelming...and the names they have.. ho my...hundreds of frameworks....
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
Open source shines at its best when everyone and their mother has a solution just looking for a problem. Unfortunately, in this case, JavaScript and web development is a real problem.
Marc
Latest Article - Create a Dockerized Python Fiddle Web App
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Skynet: Made with pure 100% JavaScript
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
Then we are saved... it will probably run into an exception and fry its circuits before it is a menace for us
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Just be happy VBScript is no longer in the browser
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Marc, as you are always slagging off JavaScript have you had a look at Elm? I've not done much more than watch part of a video but it does look nice on first impressions. But it's early days and may disappear into obscurity perhaps.
Kevin
|
|
|
|
|
Kevin McFarlane wrote: have you had a look at Elm?
Just walked through their various tutorials and tested out a partial application. Cool stuff, and I like that you can take bring it in in small steps rather than having to do a full rewrite. I'll will definitely give it a try.
Thanks for the link!
Marc
Latest Article - Create a Dockerized Python Fiddle Web App
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|