|
...is often the most time consuming. It's a simple enough ask:
Enable calculated labels in a webforms page. How hard can that be?
The challenge:
This part of the project involves review forms created by/for the customer. To keep it short, these are dynamic forms that consist of a question and the customer's choice of any basic input control including labels and textboxes.
I needed some way to allow the customer to create JavaScript for those controls that they wanted to be used in a calculation...without actually writing JavaScript...the simpler the better.
What I came up with is likely just the first phase of the solution and lets them tag textboxes with a function name and variable name. A label can also be tagged with a function name and at least a rudimentary equation can be built using the textbox variables. Additionally other statements may also be appended enabling function chaining. (so I can calculate a total which calculates an average which calculates an adjusted average, etc.)
It looks like this for a textbox:
five_day_total:day_one
For the label that receives the calculation, it look like this:
=five_day_total:day_one + day_two + day_three + day_four + day_five; five_day_avg(result); five_day_avg_adj(result):1
This shows the script that would generate a calculation/result along with two chained functions. The last argument is just the number of decimal places and is optional.
A label that is the result of a chained function might be tagged as:
=five_day_avg(sumValue):Number(sumValue) / 5:1
Anyhow, it's taken me the better part of 3 days to get it all working. I'd bet that the end user never notices, or if they do have absolutely no idea of the cursing that went into making a bit of text change. Also depressing is that it's likely a one-off method of injecting JavaScript that I'll never need again.
Oh well, the hard bit is done...time to move on to other more visible items on the punch list. This project (started in March and affectionately called my Covid project) is about 90% done and is due in 2 weeks. I have worked pretty much every weekend over the last 5 months trying to stay on course. I really need a vacation!
If you've made it this far, thanks for reading. I hope your weekend is more fun than mine!
"Go forth into the source" - Neal Morse
modified 15-Aug-20 19:29pm.
|
|
|
|
|
Too true. My take on it is, if the user doesn't notice, then you've done a great job because it's doing what they want.
Conversely, quick jobs that take under half a day with little effort can get the most praise. Its almost embarrassing.
|
|
|
|
|
Well said. I learned early in my career that my job was to design the electronics (later the firmware & GUI) so the customer didn't notice them.
One of my "lightbulb moments" at an Embedded Systems Conference years ago was the instructor pointing out the obvious when pointed out : that different end users have different requirements.
The end user basically wants an "on" switch; an "everything's OK light," and a knob to change a setting (which kind of setting depends on which of our products). Service needs more information. Production needs still more information. I need even more information.
|
|
|
|
|
Welcome to my world. I do the UI's on our products, which control commercial ink-jet printing systems[^]. These are incredibly complicated beasts. We have a ridiculous number of buttons and knobs for our sophisticated users, and yet we have some who 'just want to print'. I work hard at supporting the range of user expectations we have. There is as much code in the user interface as there is in the operational code that runs our presses.
And yet... In countless meetings, design reviews, and hallway conversations, people say to me:
"Can't you just put in a popup?"
My oft-used joke is, I feel like Michaelangelo when the Pope told him "But I wanted the ceiling painted blue."
Software Zen: delete this;
|
|
|
|
|
Propose a design for how a jack-in-the-box would integrate with your product and see if it gets accepted.
|
|
|
|
|
Similar, but different.
It got back to me that corporate senior management came up with a question at one of their meetings - which was 'what do I do?'. Apparently they didn't realize my infrastructure supports half the damn company.
It made me resort to something that heretofore I never did (a mistake?): I put a creation date, last updated date AND my name on the pages. Withing a day or two my name was in their face for almost anything they did. Nothing about similar comments has gotten back to me since.
As an aside - I was trying to train my replacement. They just don't seem to want to commit anyone's time. I comment my code but there are a lot of abstractions that need to be explained and (especially since COVID) my understudy has no time allocated to this at all. When I quit or retire (or maybe they'll fire me?), everything will keep working - but nothing will change and should a bug show up, no one can fix it. This is not going to go well for them. Pffffffffft.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I was going to say never underestimate the stupidity of management. But the reality is, the people who grease the gears and keep things running never have time to play the political games that keep them visible. We currently have an HR manager leaving who doesn't do anything but schmooze people all day long and complains when he actually has to try to hire someone. His replacement is getting over a year of training. Meanwhile, my boss is no longer with the company and they aren't in a hurry to replace him, yet he (and I luckily for them) touch every part of the plant.
|
|
|
|
|
I would be cursing at having to hit the shift key for an underscore twice for almost every name. That's one reason I hate underscores as part of variable names. The other reason is that it breaks up the name visually, so it doesn't look like one thing, but many things connected in mysterious ways. I would never foist this on a customer.
|
|
|
|
|
Bear in mind that S04E01 was launched in December last year (and wasn't that good, IMHO): The Grand Tour: Madagascar Special Release Date Finally Revealed | Grand Tour Nation[^]
tl/dr: September 4th. Yes, this year ...
OK, so Covid has slowed things, but ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Based on my rant on the Insider News[^] I realized, this is an interesting question (well, at least for me!)
What makes a language aesthetically pleasing?
Is that something that should be considered when choosing a programming language (assuming you have choice)?
What languages do you find aesthetically pleasing to work in and why?
My answers:
Q1: No pointers, no &, type safety, left-to-right readability, meaning that types are on the left, not the right, return types are on the left, not the right, expressiveness in how things are returned -- tuples, for example, are cool when used judiciously, as are ref types (ok, that's almost like a pointer.) Expressiveness in conditionals, loops, support for functional programming style, and must support reflection (ok, that's not exactly a language feature but is related to how the compiler treats the human-readable code.)
Q2: YES!
Q3: C#!!! For the reasons stated in the answer to Q1
|
|
|
|
|
I'm reasonably tolerant when it comes to language aesthetics. Any modern, structured language would be fine. For many years, I worked in a proprietary language with keywords instead of braces, and with types and return values on the right:
IF...THEN...ELSE...ENDIF;
[FOR | WHILE] DO...ENDDO;
DCL <name> <type> [INIT <value>];
DCL <name> PROC(<args>) RETURNS <type> IS BLOCK...ENDBLOCK;
It also had pointers, constness, strong typing, and various things that were innovative for a language designed around 1977. In the mid-1990s, it evolved to include object orientation. Had it been made publicly available from the outset, it would probably have displaced C.
Q1. Type safety, object orientation, tuples, templates (or at least generics). For what I'm doing, I need pointers and no garbage collection. Any high-level constructs (e.g., for threading) will probably be wrong or just get in the way.
Q2. Aesthetics, sure. But the unaesthetic language beats the paternalistic language every time, where paternalism means the language precluding something that you need to be able to do because the language designers thought they knew better.
Q3. C++, not so much because I find it aesthetic, but because I don't find it paternalistic. There are certainly things I dislike about it, but they don't center around aesthetics.
|
|
|
|
|
Greg Utas wrote: Had it been made publicly available from the outset, it would probably have displaced C.
Hmmm - it sounds similar to Ada, so I suspect C would have survived as 'language of choice'...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Sure, no different than VHS vs Betamax. But it was a competitive advantage in that our major competitor used C. It was mature several years before Ada and wasn't a kitchen sink language. It could also have come with an O/S suitable for large, embedded systems, and a version control and build system that was also advanced for its time, and synchronized for multi-site development by the late 1980s.
modified 17-Aug-20 6:44am.
|
|
|
|
|
Greg Utas wrote: Had it been made publicly available from the outset, it would probably have displaced C.
More likely, it would be ignored because it is insufficiently C-like. This criticism occurs in spite of the fact that C has not yet been inventedpopularized .
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing 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
|
|
|
|
|
I love thinking about random stuff like this
1) As long as the language's syntax is easy for my eyes to parse quickly after learning it, I'm cool with it. The only languages I really don't enjoy are the ones that use keywords for structural information. It makes them harder to read in my opinion because there's no categorical distinction between functional and structural elements.
public class Example
public property Info as string
end class
dim specificExample as Example
is way harder to parse than
public class Example
{
public string Info { get; set; }
}
Example specificExample;
in my opinion. It gets downright silly when you start adding more complexity like manually-implemented properties, methods, etc.
2) Yes, for practical reasons. If a language is difficult to read it will take longer to maintain and be more prone to developer error.
3) C#, F#, Typescript, and C++ come to mind as languages I've enjoyed working in. I will say though C++'s types have never made sense to me. Why, in a language designed to read left-to-right, does the type read right-to-left?
int const * * const example;
EDIT: Typo in the VB code
EDIT2: Removed the specificity of #3's example given the comment.
modified 17-Aug-20 15:13pm.
|
|
|
|
|
In C and C++, you have a type and you have a variable. Period. All of the pointer or reference nonsense is part of the type.
Reference is just a hidden pointer that MUST be initialized.
I think you meant "const int" based on the comment.
|
|
|
|
|
Y-yea? I'm aware of that and confused on why you would think I wasn't. Also "const int" is the same thing as "int const." Try it. I prefer "int const" because it's more consistent with how the rest of the type is read.
EDIT: Ohh, I think I get the confusion? I specified variable declarations because it's the simplest scenario. Method parameters, returns, etc are all still using a type the same way basically (blueprinting some region of data) so I tend to think of them in the same vein. My bad if that was confusing.
modified 17-Aug-20 15:08pm.
|
|
|
|
|
You were talking about why is it right to left for declarations. I am pointing out that I parse those left to right as
Type, variable.
const int **, example.
// gcc takes this. Really const?
const int const x;
I guess if you are reading more right to left for declarations, then your int const is the same as my const int.
Reminds me of a friend who was an Arabic speaker as his primary language.
He would always read ">" as "less than" when speaking English, but never missed the correct logic.
|
|
|
|
|
Ah, I get what you mean!
On the gcc thing, const is an idempotent modifier so letting it apply multiple times doesn't cause issues. This works too: const const int const const x = 5; Good for triggering a mild existential crisis in an OCD developer
|
|
|
|
|
About left-to-right-ness, I agree, but I don't completely like what C# is up to. I don't like that the array-thingy goes on the right: the opposite side of where everything goes (list-of-T, pointer-to-T etc, but T-fo-yarra). Since it works that way but actually the "array-ness" does compose by "stick an extra pair of brackets on the left side of the existing list of brackets" (T[][,] is an array of 2D arrays of T not the other way around), it's even worse: the outer level of "array-ness" is stuck somewhere in the middle of the type.
I don't like Go, but the brackets go on the left of the type, and I like that.
|
|
|
|
|
I use C# because it enables me to write better code faster.
/ravi
|
|
|
|
|
Assembly code on a RISC processor. What you see is what you get.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
My favorite FORTRAN qualifies for a number of these.
|
|
|
|
|
Q1: Languages whose design allow for an improved developer experience. One of my favorite things about C# is editing in Visual Studio. Syntax highlighting, IntelliSense, refactoring, are all fantastic. I find I make better choices for identifier names when it costs so little to use and change them as needed.
Elements that are used most often have the simplest expression. For example, C and its derivatives use { and } to denote the beginning and ending of logical blocks. Languages like BASIC, FORTRAN, Pascal, and Ada that use if then ... else ... end if and similar keywords take longer to read.
Languages that don't require separate declaration and definition for a body of code. While having the separation is a convenience for library and API designers, that imposes a burden on everyone else. You have to ensure that the declaration and definition are kept synchronized. If they become dissociated, either the compile fails (Ada) or the link fails (C and C++), often with less-than-useful diagnostics.
Languages without restrictions on the naming of identifiers. Go's use of case to indicate visibility is vile, because it forces the language designer's naming convention on the language user.
Free form languages, where white space is not significant.
Q2: Yes, but it's not the primary concern. First concern is tooling for the target environment. We have embedded components where the language is dictated by the target (C or assembly language).
Q3: C#, C++, and C. Like you, for the reasons mentioned in the answer to Q1. My primary product uses a mix of the three languages. C# in the UI, C++ in some Windows services, and C in embedded hardware. The language similarities let us share code for interfaces and such, even when the compilers and target environments aren't all that similar.
Software Zen: delete this;
|
|
|
|
|
I don't do any collaborative or Web projects any more. I mostly do SLJ's. So, libraries are more important to me than aesthetics. Mostly, I do C# and Python now. Some C-like on the Arduino. I agree with most choices I see here... except FORTRAN, used that in the 60's. There were 2 choices: FORTRAN and Assembler. I would retire, but I never commented my code.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|