Programming

exohuman, in Turbo 8 is dropping TypeScript
@exohuman@programming.dev avatar

Honestly, having used both extensively at different points for years I can say that I understand his approach for smaller projects, but Typescript coupled with coding standards, makes working with large teams and large code bases 1000x better. Being able to immediately know what data is being passed where at a glance is invaluable.

amio, in AI and Coding.

ChatGPT is a language model, it's not intended for code and you're using it "off label" at your own risk. It can produce working code, which is impressive in itself, but in order to know if it's decent code you still need to be competent with that language. I had someone run a few prompts for me a while back, it ignored central parts of the query, and its output was basically like a very junior developer - fair enough, but not great or even that good.

Potentially useful, but if you expect it to be more than one part of the "process", you might be setting yourself up for trouble.

Edit: just like it's not a coder, it's not a search engine or knowledge base, either. It just knows language and what seems like it ought to follow a given phrase. Be very aware of this difference, because sometimes it spits out 100% falsehoods with the same level of confidence and authority as the true stuff.

Kichae, (edited )

I think it's important for people to also truly understand that generative machine learning models like ChatGPT also only "know" what they've seen before. There's no interpretation or synthesis. It merely regurgitates what it's seen, with some sampling from a probability distribution.

This means, if you're asking for something niche, and it's only seen what you're prompting it for once (or, really, the same text repeatedly across multiple websites) , there's a very good chance that it will just recreate that artifact wholesale.

Which means you need to be cognizant of what the license for that material is before you use it in a product!

grmpyprogrammer, in How do you deal with management and tech debt?

Long-time PHP dev here with 25 years of experience. The unwillingness of your lead dev to consider tools better-suited to the task is going to be a problem. I know you don’t want to bounce so soon but things are going to get painful as all the friction from ignoring tools that Laravel wants is gonna start a metaphorical fire.

Good luck.

Crunkle_Foreskin,
Crunkle_Foreskin avatar

Thanks very much for commenting.

melroy,
@melroy@mastodon.melroy.org avatar

@grmpyprogrammer @Crunkle_Foreskin I think "this is called senior dev" is unwilling, maybe not the lead developer per se.

darklypure, in Code comments are (mostly) a violation of DRY

Having spent many times having to walk Technical Architects through code, explaining what it does, or trying to introduce new coders to software development, I comment line by line. It's not just experienced coders that have to look at your code. I will never not do this.

burliman,

This is a little bit of a case in point of why documentation should not be written by the teacher. It should be written by the student. The student takes no knowledge for granted and so will only repeat themselves insofar as they need to. The teacher will either repeat themselves consistently, or just leave massive gaps due to their preexisting knowledge. Even though it wouldn’t be practical for a coder to have some student document their code, I feel like this still illustrates the point. Also it means you have to constantly put yourselves in the shoes of some future student, which seems like a good practice anyway.

danrot,

I think this is also in line with my article, since not being able to put yourself into somebody else's shoes (or even in yourself future's ones) is the reason for so much bad comments. But adding a comment to every single line cannot be the solution either, at least not in a higher programming language.

parpol, in Turbo 8 is dropping TypeScript

I hope I never have to work with this person. What a shit take.

v_krishna,
@v_krishna@lemmy.ml avatar

There’s likely a lot of reasons one wouldn’t want to work with DHH. It’s unfortunate because he is clearly really brilliant but seemingly fails to realize that a huge amount of software engineering involves working together with other people, many of whom aren’t that brilliant.

wave_walnut, in How is Visual Studio?
wave_walnut avatar

Be aware of differences below:

  • Visual Studio 2022 / 2019 is All-in-one IDE software (like PyCharm of Python)
  • Visual Studio Code (VSCode) is simple Text editor with IDE functions and several extensions
levmyskin,

Yes exactly. I believe OP is talking about the former, but what he really wants is the latter

Calcharger,
Calcharger avatar

I mean I just want a handy IDE that I can do python, javascript, and eventually c# when I learn it, instead of continuing to use IDLE and whatever IDE javascript comes packages with

MrScottyTay,

Personally I think as a beginner VS is better than VS Code. I'm a professional and VS Code is still overwhelming to me because of the palette system instead of easy drop down menus and whatnot. I want to like VS Code but I can't get past not knowing what the commands are for the multitude of plugins I need to mimic even a fraction of VS's capabilities.

levmyskin,

Yeah, I get that. I feel vs code is in this super weird limbo of a wannabe user friendly editor, but really not. And you have to deal with json configurations and whatnot. Honestly, for me jetbrains ides are the best full blown ides out there (even though I'm personally using neovim at the moment). I do believe though that vs code has its perks, such as being completely multiplatform and very popular on the web (that is, you can easily find solutions for your problems).

AlteredStateBlob, in AI and Coding.
AlteredStateBlob avatar

I have built several programs with ChatGPT 4 by now. From very basic Python scripts to Python webscrapers and C# in combination with Unity3D.

In the beginning it was much better than it is currently. At the moment context is severely hampered no matter the limit and you'll be bashing your head against circular arguments and it straight up ignoring stuff you just posted two messages ago.

Trying to troubleshoot code it wrote a few days ago will be a slog and like dragging yourself over nails at times. Here's what I have found to help and make life better:

  1. Be very, very, very precise in your instructions. And keep them saved, so you can reuse them later (point 4)
  2. From the very start plan to build your project with small functions that interact (good policy anyway) which makes troubleshooting and changing these functions much easier and will prevent you running into message limits.
  3. If it fails to work for you the way you need it, you'll might have to scrap your entire code and start over with ChatGPT -> Again, the reason for point 2 being very important. Scrapping one functin is much less painful than an entire tool.
  4. Start new chats when you feel the quality degrading. Sometimes it helps and since the context is garbage at the moment anyway, it doesn't matter much.
  5. Post the code it is supposed to fix every single time. It will inevitably refer to other code, code hallucinations, etc. otherwise. Again why point 2 is important.
Avalanched,
Avalanched avatar

god I hate those circular arguments, it's like you're arguing with a todler

ono, in Code comments are (mostly) a violation of DRY

I guess one could understand why the author believes this if his experience has been (mostly) limited to poorly commented code.

danrot,

I have also seen well commented code, but in this article I concentrate on the bad ones. Are you saying you have never seen a bad code comment?

magic_lobster_party, in Code comments are (mostly) a violation of DRY

Comments should be used when it’s hard to convey the intent using only code. For example, maybe there’s some unintuitive border case that must handled. Then it could be useful to add some explanation with a comment.

I also like to add comments when I find some clever solution/workaround on the web. For example, some stack overflow answer or Wikipedia page of some algorithm.

peter,
@peter@feddit.uk avatar

Comments are also useful when something appears to be wrong but there’s a good reason why it’s like that

magic_lobster_party,

// Don’t remove this comment! Production will break if removed

danrot,

Totally agree, that's why I also mentioned this in the article.

Very often good code that is self-explanatory does not need any comments at all and if it does, the comment should describe why it has been implemented this way instead of just repeating what the code already says.

pirate526, in Code comments are (mostly) a violation of DRY
pirate526 avatar

While I agree with some of the premises here, I personally disagree that comments are even mostly a problem (a code smell). IMO they’re just as often bad as code is. A developer in a rush, or simply not taking enough care in their work, can produce both bad code and bad comments.

Perhaps someone who is trying to take care can do more harm in the comments area, when they should be perhaps looking at writing self documenting code, but in my experience they usually go hand in hand.

I use quite a lot of comments in my code and I wouldn’t regard it as code smell or even messy. I often use comments to logically separate more complex sections of functionality.. or discussing how it works and why it’s necessary to exist in the first place. Code can’t always tell you why it’s there..

I also use docblocks in some libraries, even though types are available, as the published package benefits from having an API document published alongside it. The comments there facilitate its construction.

I know this article wasn’t bashing every use of comments in code but I feel like it didn’t account for all the positive uses of them either. Teaching developers that a language feature is just mostly bad is irresponsible - we should be encouraging good comment use alongside clear code.

burliman,

The code is the “what”, the comments are the “why”. It’s the mantra I use when making them. So in a fundamental way, they never repeat themselves.

danrot,

I agree with almost all of what you say, but the thing IME is that in most cases people learn to comment a lot, which results in comments that feel like they've been done just for the sake of it, which is one of the main problems IMO. It's not like "just add a comment, it won't hurt", since comments can be immensely misleading and literally take a lot of time until figuring out that the comment was wrong if you trust the wrong ones.

I also agree that this tends to be worse with bad code, which also is not surprising. Sometimes it feels to me like people think they can fix bad code with some comments, and I think that is far from being true.

I also admit that especially the title of the article might be a bit provocative, but giving the general positive sentiment of comments I think this is called for. Sometimes you have to exaggerate a bit to get some attention. I don't like click-baiting either, but unfortunately it works ;-)

mindlessscrollingparrot, in Code comments are (mostly) a violation of DRY

DRY is not an inviolable rule. Some of the most tedious code to debug is because somebody thinks puppies will die if they write the same pair of lines in two different places.

danrot,

I think this is one of the most common misconceptions about DRY. Just because you have two times the same line in your code base it is not automatically a violation of DRY. If you compare if a number is bigger than 18 it is definitely not a good idea to extract that part if you are comparing the hour of the day once and the age the other time. In that case it would even be bad to create an abstration, and it would not be a violation of DRY. And I agree that something like this leads to code that is hard to maintain.

ShustOne, in Turbo 8 is dropping TypeScript
@ShustOne@lemmy.one avatar

I think the best take on this is from Rich Harris at Svelte. They are dropping it for internal Dev because they get the same feature set from JSDoc and have no build step, but they keep it for Svelte users who want TS.

asdfasdfasdf, in Turbo 8 is dropping TypeScript

My thoughts on this are:

  1. Static typing is objectively better for any non-trivial project / script. I don’t have any idea why anyone who has any degree of experience with this doesn’t understand it.
  2. TypeScript does suck, and I almost understand moving away to JS. JS is like a friend with benefits; it makes no promises, and there are no false hopes between you. Well designed statically types languages like Rust are like marriage; you trust it, and respect it a lot for that. It’s more complex but in a way that gives you confidence. TypeScript, on the other hand, makes promises but lies to you. It also makes you do shitty things to uphold those promises. In a way, that’s worse than making none at all.
noughtnaut,
noughtnaut avatar

I appreciate the imagery you bring here, but I'm quite interested in concrete examples of how TS "makes promises but lies". Don't shoot me (just yet), I'm not a TS developer, just a curious person wanting to become wiser.

magic_lobster_party,

Not OP, but my experience with TS is that the promises of type safety only works if all you’re doing is to interact with other TS code. As soon you need to interact with vanilla JS, which is often, all the type safety guarantees you were promised goes through the window.

So it’s some kind of weird hybrid. I prefer statically typed languages myself, but TS is not really it. It’s nice when it works though.

asdfasdfasdf, (edited )

Sure! Here’s an example: www.youtube.com/watch?v=u1WmiqlrqL0

IMO one of the most fundamental, important aspects of type systems is the invariants defined in your model; if I say a field is an array, that needs to be the source of truth and enforced throughout the program. That’s the whole point. Same with if something is immutable or other aspects of the type.

Utilael, (edited ) in AI and Coding.

I agree with the other comments that ChatGPT isn't really that good for programming, it hallucinates often and you end up working too hard just to try and figure out what it got wrong. However, I have found a good AI engine, phind.com, that has started to replace my google searches. It's just a wrapper for ChatGPT, but it cites its sources so you can verify or dig deeper, provides search engine results in a sidebar and has upvote/downvote options to help it improve. So it feels like a personal google "agent" that runs off and googles something for you and comes back with a concise report.

Deely,

Personally I just can't work with system that lies to me (even for a little) but all the time.
I tried to use chatGpt and Bing bot and phind.com few times and everytime I got answers that looks like real and looks like correct answer but slightly (and few times completely) wrong.
Everytime I have to reread documentation, check links, investigate is there a reason why LLM answered this way, maybe I wrong this time and LLM found something that I did not found...

I agree that phind.com get best results, but every small incorrectness here and there irks me and makes me question myself and answer as whole.

Upd: in general questions, like when you trying to investigate some new field, technology, tooling suite LLM is very, very good. When you want to get something like overview of topic that you interested in.

Otome-chan, in AI and Coding.
Otome-chan avatar

I use chatgpt a lot when coding. It's pretty good and the code is typically usable. But sometimes it messes up hard and it can take a while to realize that. Net benefit though and I'm sure the technology will improve over time.

s804,
s804 avatar

great information!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming
  • kavyap
  • ngwrru68w68
  • Durango
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • khanakhh
  • slotface
  • everett
  • vwfavf
  • rosin
  • osvaldo12
  • provamag3
  • GTA5RPClips
  • ethstaker
  • tacticalgear
  • InstantRegret
  • cisconetworking
  • cubers
  • tester
  • anitta
  • modclub
  • Leos
  • normalnudes
  • megavids
  • JUstTest
  • All magazines