|
I tried out ChatGPT and asked it to simply:
how can I make tabbed content using bootstrap? [see getbootstrap.com - CSS HTML designs]
It created a solution that contained an non-existent version of Bootstrap.
I was completely puzzled by that. Why / How did it create a link to a non-existent bootstrap code -- used a CDN link that didn't exist?
I told the AI that the version didn't exist and it attempted to create sample code with a version that does indeed exist.
But this time it stopped in the middle of typing the example. ???
I explained that it was not a complete example & it apologized and did create sample code.
however, when I attempted to run the code (HTML & CSS) the browser couldn't even render it.
This is a fairly simple thing to do. (You can see a working sample at this jsfiddle if you like[^].) I created that sample long ago.
I then attempted to direct the AI by saying, "Check out the code at <link> to help you solve the problem." But in the end it couldn't even do this simple thing.
I'm sure in a year or maybe less it will be able to do it.
|
|
|
|
|
"Coding from spec" is grunt work. I used to do the analysis, design and pseudo code; my team would then complain that they had nothing "to do" (i.e. the freedom to go off the rails).
I can see AI generating code from "a spec" ... I don't see it creating a spec for a new system that doesn't fall into a neat category like "payroll" without a lot of "prompting" (i.e. domain knowledge transfer).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
OriginalGriff wrote: if not design full systems.
I won't be holding my breath on that one.
|
|
|
|
|
Well there is already a serious problem with cut/paste of source without understanding it.
Now we'll get AI generated code, but how does one support this? If it's safety critical, who is legally responsible?
This is a version of the self driving car issue.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
|
Yet apparently we'll need only one, which will do everything.
|
|
|
|
|
What a dramatic statement
I see it more like this: There will be many fighting each other
|
|
|
|
|
|
Highlander!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
It's recursion without wisdom.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Reminds me of all the JavaScript Frameworks out there...
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
So what from mentioned tools can be tried for free?
|
|
|
|
|
I was explaining the concepts and general thrust behind template based metaprogramming in C++, and I found myself eventually telling my audience that template metaprogramming is powerful and subversive, in that it lures you into doing evil. I stand by that.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I agree! I used to work with a very good programmer who had one defect - if it could be done by template metaprogramming, it would be done by template metaprogramming. His code almost always worked, but was a nightmare to maintain because of all the clever tricks he used. Eventually, we had to dispense with his services.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Code maintainability is a job requirement.
Code that only you can work on should not be job security.
Nip it in the bud.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I hope you have put the proper disclaimers and the selection menus for the cookies. If not the EU regulators could come and knock on your door
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.
|
|
|
|
|
I never really saw the point, and I feel like template programming nailed fringe conditions. Then again, I don't work in a strong C++ shop. Lots of C developers that think they know C++.
As one other poster said, it just made it that much more difficult to support. Honey you live in the embedded world. Are you actually able to leverage templates to make your life easier? Does it allow you to target a new platform faster?
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
I agree. But C developers can get hung up on the use of macros (sort of like templates, I guess, since I don't use C++).
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Probably you lean on macros a lot.
I prefer templates when I can use them for a few reasons.
Type checking
Greater flexibility in terms of
Recursively generating multiple code statements from one instantiation
Computing conditions at compile time so you don't have to do them at runtime.
And you can use them in places where you can't really use macros, but the reverse is also true.
To err is human. Fortune favors the monsters.
|
|
|
|
|
good points.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Macros are okay, complex macros are a disaster.
Forgive me if I am wrong, but I have always considered macros as a source code substitute. If the macro is made to help simplify code - okay. If you are hiding complex calculations - not so much okay. Put the sucker in a function.
Any time I've run into creative macro code, its an elephant ****.
So, I say again - how do templates make my life easier?
We have the 4 pillars of OO development, blah blah - roll with me here a bit. I support code that has a few layers of inheritance. It's cute but can be painful. It's just not the silver bullet. I love abstraction, but in the end I have to live with this code - I need it to be understandable, not cute.
So back to templates. Templates seem cute to me. They make the code complex to understand and to debug.
Am I wrong? I honestly ask this question. I've read the description of the problems templates are supposed to solve, but 0..0000001% applies to me.
That's why I would love to see you, honey, maybe generate a practical article on how a template solution solved an issue.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
I've written articles like that Metaprogramming in C++: A Gentle Introduction[^]
This for example, was basically gleaned from the starting point of my GFX library.
Now, as for a real world problem, consider supporting arbitrary binary footprints and color spaces for pixels. Pixels you can declare in any color model, with any bit depth, divided however you want among the color channels.
Now imagine computing the bitshifts to draw to a bitmap with say, RGB666 format, or indexed color, or RGB565, etc.
You can do it at runtime, and you'll get 3 frames per second.
Or you can do it at compile time and get better than 30.
Here's the documentation on my pixel<> template.
This would be impossible to do realistically without templates.
https://honeythecodewitch.com/gfx/wiki/pixels.md[^]
To err is human. Fortune favors the monsters.
|
|
|
|
|
ahhh, off to read.
I fear I must confess that most of the time I live in the world of "add more power". You allude to the nugget that template programming allows you to optimize the performance.
Thank you, I shall read. My initial response would be - why would not polymorphism solve this issue? A detectable change in the interface would transition off to another chunk of code. Why could I not have the data in a generic format and allow my code to adapt?
Note: don't go ballistic on me. I've only struggled with templates (meaning I really don't understand them). The above questions are rhetorical until I read your articles.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
You can't afford to make one function call per pixel when drawing graphics. That's the only way binary interfaces can really work in this case. If I make a base pixel class and it needs to be squishy enough to accommodate a 24-bit HSV pixel and a 16-bit RGB pixel then every time I act on that pixel a couple of things happen
A) I need to call a function to get any actual usable color information off the thing, or to convert it to a different format.
B) In order to realistically make it "polymorphic" practically, the actual channel values would *have to be* scaled floats.
Now, one function call is not a big deal. Except multiply that times 320x240x30 times per second, on a 240MHz (or worse machine)
It's worse than that. Honestly, polymorphism costs so much comparatively because you can't even do batched pixel operations, like say, filtering multiple pixels at once because the data is no longer available, but rather it's hidden behind a generic binary interface.
Even on a PC I'd expect 10x improvement in performance using templates, which allow you to work with the pixels as a contiguous stream of data that they can act on natively rather than having to translate every element through a conversion interface that genericizes it.
I'm trying to explain it as best I can without actually getting into code. I hope that helps.
To err is human. Fortune favors the monsters.
|
|
|
|
|
In particular see 1.7 in the document i linked to - declaring a custom pixel format:
using index7 = gfx::pixel<gfx::channel_traits<gfx::channel_name::index,4,0,6>>;
using rgb565 = pixel<channel_traits<channel_name::R,5>,
channel_traits<channel_name::G,6>,
channel_traits<channel_name::B,5>>;
Imagine doing that without templates. You'd need a growable vector just to store the channels. Then imagine doing computations on them, having to go through a vector when you should be able to get what you need with a simple shift or two. Actually, scratch that. You'd need a map<> because you can look up channels by name or index.
To err is human. Fortune favors the monsters.
|
|
|
|