this post was submitted on 01 Sep 2023
7 points (100.0% liked)

Programming

21526 readers
499 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] fubo@lemmy.world 5 points 2 years ago* (last edited 2 years ago) (4 children)

Until you know a few very different languages, you don't know what a good language is, so just relax on having opinions about which languages are better. You don't need those opinions. They just get in your way.

Don't even worry about what your first language is. The CS snobs used to say BASIC causes brain damage and that us '80s microcomputer kids were permanently ruined ... but that was wrong. JavaScript is fine, C# is fine ... as long as you don't stop there.

(One of my first programming languages after BASIC was ZZT-OOP, the scripting language for Tim Sweeney's first published game, back when Epic Games was called Potomac Computer Systems. It doesn't have numbers. If you want to count something, you can move objects around on the game board to count it. If ZZT-OOP doesn't cause brain damage, no language will.)


Please don't say the new language you're being asked to learn is "unintuitive". That's just a rude word for "not yet familiar to me". So what if the first language you used required curly braces, and the next one you learn doesn't? So what if type inference means that you don't have to write int on your ints? You'll get used to it.

You learned how to use curly braces, and you'll learn how to use something else too. You're smart. You can cope with indentation rules or significant capitalization or funny punctuation. The idea that some features are "unintuitive" rather than merely temporarily unfamiliar is just getting in your way.

[–] flumph@programming.dev 1 points 2 years ago

Please don't say the new language you're being asked to learn is "unintuitive". That's just a rude word for "not yet familiar to me".

Yeah. I've written in six or so different languages and am using Go now for the first time. Even then, I'm trying to be optimistic and acknowledge things are just different or annoying for me. It doesn't mean anything is wrong with the language.

load more comments (3 replies)
[–] million@lemmy.world 5 points 2 years ago* (last edited 2 years ago) (3 children)

Refactoring is something that should be constantly done in a code base, for every story. As soon as people get scared about changing things the codebase is on the road to being legacy.

[–] NoXzema@lemmynsfw.com 1 points 2 years ago

Been with a lot of codebases that had no unit tests at all and everyone was afraid to change anything because the QA process could take weeks to months.

The result is you have a codebase that ages like milk.

[–] brettvitaz@programming.dev 1 points 2 years ago* (last edited 2 years ago)

Only if the code base is well tested.

Edit: always add tests when you change code that doesn’t have tests.

[–] myersguy@lemmy.simpl.website 0 points 2 years ago (1 children)

Who is in the wrong? Your manager, for not giving you time to refactor? Or you for giving him the option?

[–] nous@programming.dev 1 points 2 years ago

Why do you need time to refactor? It is just part of the work you need to do and should be accounted for when doing any other work. IMO a big mistake people make is thinking refactoring is some separate thing they need permission to do. You don't, if you need to make a change in some area refactor it first to make it easier to accept your change, then add your change then refactor to clean up. This is not three separate tasks, just three steps in one task. You should be given enough time to do the whole task, not just part of it.

[–] MrTallyman@programming.dev 4 points 2 years ago (1 children)

My take is that no matter which language you are using, and no matter the field you work in, you will always have something to learn.

After 4 years of professional development, I rated my knowledge of C++ at 7/10. After 8 years, I rated it 4/10. After 15 years, I can confidently say 6.5/10.

[–] BaskinRobbins@sh.itjust.works 0 points 2 years ago (2 children)

Amen. I once had an interview where they asked what my skill is with .net on a scale of 1 - 10. I answered 6.5 even though at the time I had been doing it for 7 years. They looked annoyed and said they were looking for someone who was a 10. I countered with nobody is a 10, not them or even the people working on the framework itself. I didn't pass the interview and I think this question was why.

[–] CodeBlooded@programming.dev 1 points 1 year ago

As a hiring manager, I can understand why you didn’t get the job. I agree that it’s not a “good” question, sure, but when you’re hiring for a job where the demand is high because a lot is on the line, the last thing you’re going to do is hire someone who says their skills are “6.5/10” after almost a decade of experience. They wanted to hear how confident you were in your ability to solve problems with .NET. They didn’t want to hear “aCtUaLlY, nO oNe Is PeRfEcT.” They likely hired the person who said “gee, I feel like my skills are 10/10 after all these years of experience of problem solving. So far there hasn’t been a problem I couldn’t solve with .NET!” That gives the hiring manager way more confidence than something along the lines of “6.5/10 after almost a decade, but hire me because no one is perfect.” (I am over simplifying what you said, because this is potentially how they remembered you.)

Unfortunately, interviews for developer jobs can be a bit of a crap shoot.

[–] fkn@lemmy.world 0 points 2 years ago (1 children)

Your mistake was giving them an answer instead of asking how the scale was setup before giving them a number. Psychologically, by answering first your established that the question was valid as presented and it anchored their expectations as the ones you had to live up to. By questioning it you get to anchor your response to a different point.

Sometimes questions like this can be used to see how effective a person will be in certain lead roles. Recognizing, explaining and disambiguating the trap question is a valuable lead skill in some roles. Not all mind you... And maybe not ones most people would want.

But most likely you dodged a bullet.

[–] BaskinRobbins@sh.itjust.works 1 points 2 years ago

I was kicking myself for days afterwards for not doing exactly as you said. I'm not good at these types of interview questions in the moment. Also before that was the tech interview classic of asking a bunch random trivia questions, which I actually nailed. Also this was for dev II position.

I definitely dodged a bullet though. Some months later I got hired at a different company for 30k more.

[–] AdmiralShat@programming.dev 4 points 2 years ago* (last edited 2 years ago) (2 children)

If you don't add comments, even rudimentary ones, or you don't use a naming convention that accurately describes the variables or the functions, you're a bad programmer. It doesn't matter if you know what it does now, just wait until you need to know what it does in 6 months and you have to stop what you're doing an decipher it.

[–] Kolanaki@yiffit.net 1 points 2 years ago* (last edited 2 years ago)

it doesn't matter if you don't know what it does now

If I don't know what it does now my comment of "I have no idea wtf this does" won't help me in 6 months.

[–] fkn@lemmy.world 1 points 2 years ago (1 children)

Self documenting code is infinitely more valuable than comments because then code spreads with it's use, whereas the comments stay behind.

I got roasted at my company when I first joined because my naming conventions are a little extra. That lasted for about 2 months before people started to see the difference in legibility as the code started to change.

One of the things I tell my juniors is, "this isn't the 80s. There isn't an 80 character line limit. The computer doesn't benefit from your short variable names. I should be able to read most lines of code as a single non-compound sentence in English with only minor tweaks and the English sentence should be what is happening in most of those lines of code."

[–] MajorHavoc@lemmy.world 1 points 2 years ago (1 children)

There's no such thing as self documenting code, unless every method and variable name has the word "because" in it.

Anyone can read what the code does. The comments are there to answer why it does what it does the way it does.

Why is invariably lost to time, if it's not committed to a comment here and there.

[–] fkn@lemmy.world -1 points 2 years ago

This is a pretty ridiculous position to take but if you believe it then I'm glad you write the comments you do.

There is an argument that commenting on the lack of expected code is valuable for this reason, but it certainly isn't true in all situations.

[–] argv_minus_one@beehaw.org 3 points 2 years ago (3 children)

Dynamic typing is insane. You have to keep track of the type of absolutely everything, in your head. It's like the assembly of type systems, except it makes your program slower instead of faster.

[–] uniqueid198x@lemmy.dbzer0.com 2 points 2 years ago

You can do typing through the compiler at build time, or you can do typing with guard statements at run time. You always end up doing typing tho

[–] Cratermaker@discuss.tchncs.de 1 points 2 years ago

Nothing like trying to make sense of code you come across and all the function parameters have unhelpful names, are not primitive types, and have no type information whatsoever. Then you get to crawl through the entire thing to make sense of it.

[–] Boomkop3@reddthat.com 1 points 5 months ago

I kinda wanna say... skill issue? But really, dynamic typing is great as long as it fits the problem your solving and you keep your types simple or even just primitive

[–] Vince@feddit.de 2 points 2 years ago* (last edited 2 years ago)

Not sure if these are hot takes:

  • Difficult to test == poorly designed
  • Code review is overrated and often poorly executed, most things should be checked automatically (review should still be done though)
  • Which programming language doesn't matter (within reason), while amount of programming languages matters a lot
[–] uniqueid198x@lemmy.dbzer0.com 2 points 2 years ago

Programing is a lot less important than people and team dynamics

[–] witx@lemmy.sdf.org 2 points 2 years ago (1 children)

Python is only good for short programs

[–] NBJack@reddthat.com 1 points 2 years ago

Python should not be used for production environments, or anything facing the user directly. You are only inviting pain and suffering.

[–] bidenicecream@hexbear.net 1 points 2 years ago* (last edited 2 years ago)

Computer hardware has been getting faster and faster for decades at this point, but my computer still slows down. Like WTF. The dumbass programmers take the extra power given to them and squander it instead of optimizing their code. Microsoft word could run pretty well on a windows 98 PC, but the new Word can slow down PCs that are 5-10 years old. Programmers are complete idiots sometimes...

[–] Elderos@lemmings.world 1 points 2 years ago* (last edited 2 years ago)

The best codebase I have ever seen and collaborated on was also boring as fuck.

  • Small, immutable modules.
  • Every new features was coded by extension (the 'o' in S.O.L.I.D)
  • All dependencies were resolved by injection.
  • All the application life cycle was managed by configurable scopes.
  • There was absolutely no boiler plate except for the initial injectors.
  • All of the tests were brain-dead and took very minimal effort to write. Tests served both as documentation and specification for modules.
  • "Refactoring" was as simple as changing a constructor or a configuration file.
  • All the input/output of the modules were configurable streams.

There is more to it, but basically, it was a very strict codebase, and it used a lot of opinionated libraries. Not an easy codebase to understand if you're a newbie, but it was absolutely brain dead to maintain and extend on.

Coding actually took very little time of our day, most of it consisted of researching the best tech or what to add next. I think the codebase was objectively strictly better than all other similar software I've seen and worked on. We joked A LOT when it came time to change something in the app pretending it would take weeks and many 8 pointers, then we'd casually make the change while joking about it.

It might sound mythical and bullshity, and it wasn't perfect, it should be said that dependency injection often come in the form of highly opinionated frameworks, but it really felt like what software development should be. It really felt like engineering, boring and predictable, every PO dreams.

That being said, I given up trying to convince people that having life-cycle logic are over the place and fetching dependencies left and right always lead to chaos. Unfortunately I cannot really tell you guys what the software was about because I am not allowed to, but there was a lot of moving parts (hence why we decided to go with this approach). I will also reiterate that it was boring as fuck. If anything, my hot take would be that most programmers are subconsciously lying to themselves, and prefer to code whatever it is they like, instead of what the codebase need, and using whatever tool they like, instead of the tools the project and the team need. Programming like and engineer is not "fun", programming like a cowboy and ignoring the tests is a whole lot of fun.

[–] r1veRRR@feddit.de 1 points 2 years ago (1 children)

Compiler checked typing is strictly superior to dynamic typing. Any criticism of it is either ignorance, only applicable to older languages or a temporarily missing feature from the current languages.

Using dynamic languages is understandable for a lot of language "external" reasons, just that I really feel like there's no good argument for it.

[–] kaba0@programming.dev 1 points 2 years ago

I do believe that static typing is at least a local optimum, but I am still not entirely convinced. Rich Hickey is a very convincing presenter and I can’t help but think that he is on to something — with Clojure the chosen direction is contract-typing, which is basically a set of pre- and post-conditions for your functions that are evaluated at runtime. Sure, it has a cost and in the extremes they are pretty much the same as dependent types, but I think it is an interesting direction — why should my function be overly strict in accepting a “record” of only these fields?

[–] flamboyantkoala@programming.dev 1 points 2 years ago

Agile in it’s current implementation with excessive meetings wastes more time than the mistakes it tries to avoid.

[–] asyncrosaurus@programming.dev 1 points 2 years ago (1 children)

SPAs are mostly garbage, and the internet has been irreparably damaged by lazy devs chasing trends just to building simple sites with overly complicated fe frameworks.

90% of the internet actually should just be rendered server side with a bit of js for interactivity. JQuery was fine at the time, Javascript is better now and Alpinejs is actually awesome. Nowadays, REST w/HTMX and HATEOAS is the most productive, painless and enjoyable web development can get. Minimal dependencies, tiny file sizes, fast and simple.

Unless your web site needs to work offline (it probably doesn't), or it has to manage client state for dozen/hundreds of data points (e.g. Google Maps), you don't need a SPA. If your site only needs to track minimal state, just use a good SSR web framework (Rails, asp.net, Django, whatever).

[–] nayminlwin@lemmy.ml 0 points 2 years ago (1 children)

I'm still hoping for browsers to become some kind of open standard application environments and web apps to become actual apps running on this environment.

[–] icesentry@lemmy.ca 1 points 2 years ago

How are browser not that already? What's missing?

They are an open standard and used to make many thousands of apps.

[–] chicken@lemmy.dbzer0.com 1 points 2 years ago

I am not smart enough to effectively code with certain languages and design patterns and that's ok. There is nothing wrong with accessibility being prioritized or with making tradeoffs for the sake of reducing complexity.

[–] enemenemu@lemm.ee 1 points 2 months ago

Don't be afraid to drop a tool although you've spent years mastering it if there is something new that is much more efficient. Some day you have to switch anyway.

[–] corstian@lemmy.world 1 points 2 years ago

Most modern software is way too complex for what it actually does.

[–] Buttons@programming.dev 1 points 2 years ago

Shorter code is almost always better.

Should you use a class? Should you use a Factory pattern or some other pattern? Should you reorganize your code? Whichever results in the least code is probably best.

A nice thing about code length is it's objective. We can argue all day about which design pattern makes more sense, but we can agree on which of two implementations is shorter.

It takes a damn good abstraction to beat having shorter code.

[–] words_number@programming.dev 1 points 2 years ago

JS is horse shit. Instead of trying to improve it or using that high level scripting language as a compilation target (wtf?!), we should deprecate it entirely and put all efforts into web assembly.

[–] eeleech@lemm.ee 0 points 2 years ago (1 children)

I find that S-expressions are the best syntax for programming languages. And in general infix operators are inferior to either prefix or postfix notation.

[–] Andy@programming.dev 0 points 2 years ago (1 children)

In case you haven't heard, Factor just had a new stable release, and is tons of fun for postfix enthusiasts.

[–] xigoi@lemmy.sdf.org 0 points 2 years ago (1 children)

I never understood how concatenative programmers can hold the current state of the stack in their head and never get confused about what is where, especially when changing complex code.

[–] chunes@lemmy.world 1 points 2 months ago

In Factor's case, combinators that insert values at quotation (lambda) boundaries.

[–] BrotherL0v3@lemmy.world 0 points 2 years ago (1 children)

Tools that use a GUI are just as good (if not better) than their CLI equivalents in most cases. There's a certain kind of dev that just gets a superiority complex about using CLI stuff.

[–] fubo@lemmy.world 2 points 2 years ago

The big thing you can do from the command line is script it.

[–] phoenixz@lemmy.ca 0 points 2 years ago (3 children)

Go with what works

Error messages should contain the information that caused the error. Your average Microsoft error "error 37253" is worthless to me

Keep functions or methods short. Anything longer than 20 - 50 lines is likely too long

Comment why is happening, not what

PHP is actually a really nice language to work with both for web and command line utils

Don't over engineer, KISS. Keep It Simple Stupid

SOLID is quite okay but sometimes there are solid reasons to break those rules

MVC is a PITA in practice, avoid it when possible

load more comments (3 replies)
[–] Crisps@lemmy.world -1 points 2 years ago

Dynamically typed languages don’t scale. Large project bases become hard to maintain, read and refactor.

Basic type errors which should be found in compilation become runtime errors or unexpected behavior.

load more comments
view more: next ›