IcecreamMelts,

Microsoft has not made a good product. Ever. Every program has issues that should not be there if you’re selling it. Yet they get away with it

darcy,
@darcy@sh.itjust.works avatar

typescript? i know its a bandaid on a severed leg at this point but still

MashedTech,

Hahah

Droechai,

Excel is a very nice product, and I really enjoy AoE2. Even if it now has a quite large tech debt with HD the release version was super stable and a leap forward compared to its contemporaries.

The first Xbox was also a very good product.

warlaan,

Visual studio has been the best IDE for a long time, and OneNote is still the best note taking application.

DerpyPlayz18,

I use OneNote everyday, but it lacks feature parity between the devices you use it on

corsicanguppy,

I have to say that at least it’s achieved in usability what I’ve used on unix for about 30+ years now. Hint: the VI tribe reeeeeeally hates it.

FMT99,

Speaking as a member of the vi tribe, I appreciate VSCode and understand why someone would prefer it, even if I don’t myself.

doubletwist,

Even as someone who has disliked MS since the mid-90s, I am willing to admit they have made some good products. The Intellimouse 2.0 was one of the best mice I’ve ever used. It was my main mouse for something like a decade, and even now, almost 25 years later, it still works as a backup mouse when I need it for something in my homelab.

spokenlollipop,

This is a bit too extreme. I guess I’d say it’s more like… they do sometimes make something good, and then make it awkward to use outside of Windows/attach other arbitrary nonsense restrictions etc.

NightAuthor,

Someone didn’t own a Zune and it shows.

CheeseNoodle,

People won’t believe me that windows is an absoloute dumpster fire, sure it works most of the time but when it doesn’t it quickly becomes apparent how much the whole thing is creaking edifice built atop pretty much every past version of itself. I could do a whole rant.

NBJack,

One Note. I have yet to see anything from anyone come close. Works with all of my devices, allows me to use a stylus for designs on an infinite graph paper canvas, and damned good at note taking.

Vince,

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
brettvitaz,

I agree with your first point, but pretty strongly disagree with the other two. Code review is critical. Devs should be discussing changes and design choices. One Dev can not be all things all the time and other people have experience you do not or can remind you of things you forgot. Programming language absolutely matters when you’re not the only dev on the team.

Windex007,

If code reviews in your org are glorified “styleguide checks”, then they are not really code reviews at all.

Also, if you’re only getting design input at code review time, that’s WWAAYY too late in the process.

Code reviews should be:

  • Establishing that the code has proper test coverage (functional correctness VIA coverage, not code observation)
  • Establishing that it doesn’t have unintended consequences in the ** implementation** (making db calls in a loop, exposing secure information, etc)
  • That the implementation is of the high-level design that was already established and agreed upon by the larger development unit.
  • A opportunity to ask questions to learn from whoever wrote the code
  • An opportunity for the reviewers to teach techniques that could have helped in the code
ndotb,
@ndotb@programming.dev avatar

You missed one:

  • To let others at least have some insight into what you’re doing so you can take a freakin’ vacation every once in a while
Vince,

Nice, so they are hot takes :D

If the design of a code change is bad, noticing that in the PR stage is not desirable. It should be discussed before someone actually went ahead and implemented it. It can also happen if people misunderstand the architecture, but again, that should be cleared up before actually implementing a change. Code style should be enforced automatically, as should test coverage and performance. Code review is also pretty bad at finding bugs from my experience. That imo leaves very few things where code review is useful that are not nitpicking.

As for programming languages, the amount does matter for individuals and for teams/organisations. A developer who can only use a single language is not very good, and using a many different languages within the same team is not good either.

flumph,
@flumph@programming.dev avatar

Code review is overrated and often poorly executed, most things should be checked automatically (review should still be done though)

I think part of this is caused by the fact that a lot of people are bad at code reviews so they focus on things that a linter could have told you. Being able to read code isn’t necessarily the same skill as being able to write it – as evidenced by the knee jerk reaction to throw out any coffee we didn’t write ourselves.

I still create code reviews when I’m working on a project alone because it gives me a different perspective on the changes I’ve made.

kaba0,

It’s not that most people are bad at it, they are just out of context.

Like, I am completely swamped with a completely different business area of the code, besides checking for obviously dumb things, what can I really tell about a diff to a very separate part of the code which I may have never worked on before, with business requirements I don’t understand as I was not part of the 10 meetings that happened between the dev of the given ticket and BAs?

argv_minus_one,

Difficult to test == poorly designed

It’s pretty much a natural law that GUIs are hard to thoroughly test.

Vince,

But does it have to be? I haven’t touched non-web GUIs since 15 years, so my perspective on this is limited. And web frontend is not what I would call a well designed system for it’s current purpose.

AlexWIWA,

Imo reviews are more for checking that someone didn’t drop malware into the code base. It’s rare that I get a good review that goes beyond checking for malice.

Xylight,
@Xylight@lemmy.xylight.dev avatar

I’ve been wanting to make my applications easier to test. The issue is, I don’t know what to test. Often my issues are so trivial I notice them immediately.

What are some examples of common things in, let’s say a web server, that could be unit tested?

Vince,

Good questions, I could probably write a lot, but I’ll try to keep it short. I usually apply TDD and there are different schools of thought within it about how to structure the development process. But no matter how exactly you do it, if you focus on writing the tests while writing your code, you won’t end up with an application that you then have to figure out how to test.

what to test

Well, what is the application supposed do? That is what you test, the behaviour of the application.

So in a codebase without any tests, the first thing you should write a test for is the happy path. That will probably not be a unit test. So for the web server example, set it up in a test with a file, start it and check if it serves that file.

Then you can add tests for all the error cases and for additional functionality. You can write unit tests for individual components. The ideal places to test are interfaces with clear boundaries. Ideally you should not have to look at the code of a method to be able to write a test for it. In reality that’s not always so easy, especially in existing code bases, but if you have to set up more than one mock, it tends to lead to brittle tests.

Every time you encounter a bug/issue, reproduce it in a test first. And do measure code coverage, but don’t make it a target, just check for places that are lacking.

Yearly1845,

Tabs are better than spaces

NightAuthor,

Pressing tab and having the appropriate number of spaces added is objectively the only right answer.

ClemaX,

But you can set a tab width instead so any developer editing the code can adjust the indentation width to his liking, without changing the actual files contents and having to worry about setting the editor up to insert the right amount of spaces.

Ajen,

Tabs for indentation, spaces for alignment

mindbleach,

Tabs are literally designed for aligned indentation, and they’re configurable for clientside viewing. There is no excuse for spaces. I don’t care if your goddang function arguments line up once they spill out onto another line. You’ve got deeper problems.

xigoi,
@xigoi@lemmy.sdf.org avatar

Tabs are designed for tabulation (hence the name), not indentation. The side effect is that a tab’s length changes based on its position in a line, which is terrible for programming. If you use tabs in the Python REPL, it looks like this:


<span style="color:#323232;">>>> def frobnicate_all(arr):
</span><span style="color:#323232;">>>>     for item in arr:
</span><span style="color:#323232;">>>>             frobnicate(item)
</span>
spartanatreyu,
@spartanatreyu@programming.dev avatar

a tab’s length changes based on its position in a line

What does this even mean? A tab is a tab.

Tab’s don’t have multiple lengths inside a file, they all have the same length.

That’s the point of tabs.

xigoi,
@xigoi@lemmy.sdf.org avatar

The horizontal tabulation character moves the cursor to the next column which is a multiple of the tabulation length. See the examples here: en.m.wikipedia.org/wiki/Tab_key

At least for me, it renders like this:

Screenshot of a part of the linked Wikipedia page

Clearly the whitespace produced by each tab character has a different length.

spartanatreyu,
@spartanatreyu@programming.dev avatar

The horizontal tabulation character moves the cursor to the next column which is a multiple of the tabulation length. See the examples here: en.m.wikipedia.org/wiki/Tab_key

Yes

Clearly the whitespace produced by each tab character has a different length.

No, each tab has the same size, the text rendered over the top of the tabs are not the same size.

Always remember the golden rule: Tabs for indentation, spaces for alignment.

mindbleach,

How long is a newline?

xigoi,
@xigoi@lemmy.sdf.org avatar

A newline is the separator between lines, so the concept of length doesn’t make sense for it.

mindbleach,

Correct.

And a tab is the separator between stops.

xigoi,
@xigoi@lemmy.sdf.org avatar

Indeed. It’s a separator, so using it for indentation doesn’t make sense.

mindbleach,

Stops are indentation.

They’re what you indent… to.

Tab goes to the next stop, the same way newline goes to the next line. Exactly the same way. If you write more text before the next line, the amount of whitespace shrinks. That doesn’t mean the “length” of a newline changes. It always goes one line.

A tab always goes one stop.

drathvedro,

The real hot take: Spaces are better than tabs. Fight me

OnichiCub,

Spaces ARE better than tabs.

FreakingSpy,

I work in a massive project where they used both. Often in the same functions. Sometimes mixing 2 and 4 spaces aswell.

xigoi,
@xigoi@lemmy.sdf.org avatar

Tabs could be a good idea if their default size in most environments (and often not configurable) wasn’t 8, which is terribly big.

spartanatreyu,
@spartanatreyu@programming.dev avatar

most environments

What environment are you using that have tabs set to 8?

xigoi,
@xigoi@lemmy.sdf.org avatar
  • Many terminal emulators (may or may not be configurable), including Termux for Android (not configurable)
  • GitHub (by default)
  • SourceHut (not configurable)
  • Vim/Neovim (by default)
  • HTML (by default, I think)

Honestly, I can’t think of an environment that doesn’t have 8-space tabs by default.

spartanatreyu,
@spartanatreyu@programming.dev avatar

Interesting…

Every IDE and editor (gui and tui) I’ve used has always come preconfigured with a tab-size of 4.

The only thing I’ve ever experienced having a tab-size of 8 was github, and I thought that was just a problem with a setting from github’s size that I quickly set back to 4.

It seems that tui editors come with tab-sizes of 8 only when a config isn’t provided, and every environment I’ve used where I’ve used a tui editor has always come with sensible configs (for things like config location, language recognition for syntax highlighting, etc…) including a tab-size of 4.

NewPerspective,

If white space carries any function that the compiler/interpreter needs to know about like structure or scope, it’s probably not a very good programming language.

sajran,

Genuine question: why? What makes, say a semicolon, so superior to the the newline or tab characters?

To be clear: I don’t think whitespace as a part of syntax is an awesome idea which should be more popular. It’s definitely a bit more error prone in some ways. It’s not perfect. But it’s okay.

I’ve written a lot of Python and I don’t think I have ever seen a syntax error caused by incorrect whitespace. I’m not exaggerating. I regularly forget semicolons in other languages but I never type out incorrectly indented code. Maybe that’s just me though…

Reptorian,

From some one who used Python as it was the easiest solution to few of my problems, and having to experience languages with brackets and/or endif/fi/done as ways to limit scope, I find that having things like brackets and/or scope terminators easier to parse and less error-prone. I’m thinking about moving on to Ruby whenever I had a need where Python would be a good choice, but the time it takes for me to understand a new language is blocking me from that.

UnfortunateShort,

I honestly think the scripting languages like fish have got it right.

Newline by default completes a line and can optionally be escaped. Saves you most of the semicolons and even implicitly highlights multi-line statements.

Whitespace doesn’t matter except for separating names.

Blocks are explicitely ended without braces you can confuse with brackets or parentheses, no matter the coding style.

If Rust and fish had a baby, I think it would be the best language to have ever been created.

NBJack,

How much of that python is written in a shared codebase with multiple active contributors? When was the last time you refactored a module?

Tabs and spaces are invisible. Semicolons are not.

sajran,

A vast majority of the code in question is the code I’ve written for my work projects with multiple active contributors and refactoring is very common too. We all like to shit on Python for various reasons but no one in my environment ever complained about whitespace.

Like I said, I don’t think whitespace is perfect as a part of syntax but I’m much more likely to forget a semicolon than a proper indentation and this applies to any language. I guess it’s not universal tough, because you can often see code with messed up indentation on online forums etc. TBH this is just unthinkable to me, indentation is absolutely necessary for me to be able to read code and reason about it. When I’m thinking about blocks and scopes it’s not because I counted semicolons and braces, it’s 100% indentation.

DeprecatedCompatV2,

How do you feel about line breaks?

jvisick,

Not who you asked but I think they’re important for humans, but syntactically I don’t think they should matter

Thoth19,

Intmain(intfoo){std::out<<"HelloWorld";}

Is a great program and should totally be valid cpp. White space sucks.

/S

mindbleach,

Load-bearing whitespace is the fucking devil. This thread about hot takes is topped by a comment highlighting how people can’t even agree what kind of whitespace to use.

Python - you want code to fail if someone from one camp copy-pastes code from another camp, and the characters that make a difference are invisible?

NBJack,

Load bearing whitespace. Damn, I love that phrase.

Also, if you have to have agreement on the tabs or spaces argument in your codebase in order to get it to compile, you have already lost.

valentino,

The amount of unqualified people is staggering beginning with those who have no university education.

firelizzard,
@firelizzard@programming.dev avatar

Degrees are meaningless, excepting places like CalTech. I’ve known too many ‘programmers’ who had a CS degree yet were damn near useless to think otherwise. Not to mention my own CS degree taught me almost nothing.

FMT99,

Agreed. I’ve known a lot more self-taught folks worth their salt than those with degrees. And those with degrees almost all started coding before they got to the university age.

valentino,

Seems like you went to a shit university

lysdexic,

If you’re worried about your degree’s worth then you are certainly not he right person to talk about going through a shit university.

firelizzard,
@firelizzard@programming.dev avatar

I wouldn’t say it was a shit university, part of it is that I knew how to write code before I got there. But the CS program wasn’t great. My entire point is, if someone has a CS degree from University X and you don’t know if that program at that university is any good, the degree is meaningless. If the university’s CS program isn’t any good, you can’t count on the degree meaning anything.

CodeBlooded,
@CodeBlooded@programming.dev avatar

Degrees are meaningless

my own CS degree taught me almost nothing

I think you meant that your degree was meaningless?

firelizzard,
@firelizzard@programming.dev avatar

My entire point is that any CS degree from any university is meaningless unless you know that university’s CS program is actually good

AnAngryAlpaca,

There are also a lot of e-commerce agencies who just don’t have their sh1t together. Was expected to work on 3 different clients a day who all had different platforms, different requirements etc.

Yes, you can dump some new code into the project that looks like it’s working, but then you don’t have time for any unit tests, exception handling if the user won’t cooperate etc. The other “senior” programmer in the company never set up any local environment but instead ftp’d all changes directly to the live server. I asked him if needs help to set up a local server and debugger, but instead he would just dump vars on the live server and stream the contents of error.log to his second screen to catch any issues…

lysdexic,

The amount of unqualified people is staggering beginning with those who have no university education.

I don’t see it as a problem, because qualifications without competence is meaningless.

You should be more concerned with how qualified people end up performing worse and being less educated, knowledgeable, and prepared than unqualified people.

vvv,

Mandatory pull requests + approvals within a team are a waste of everyone’s time.

uniqueid198x,

We’v known this for twenty years and had the data ta back it up for ten. Github flow is one of the most damaging things to ever happen to software teams

10nica,

Omfg yes! Have nothing to add, but an upvote was not enough to express my hate for gitflow. So fucking stupid. And you’ll show stats from Jez Humble etc about trunk based, and my boss was still “eh not convinced”

TrustingZebra,

Git Flow and GitHub Flow are entirely different branching strategies.

uniqueid198x,

Gitflow is has the same issues

TrustingZebra,

Git Flow is awful I absolutely agree. On the other hand I like GitHub Flow.

uniqueid198x,

Github flow has the same issues, in practice. Branching is the root cause, not the kind of branching. Even anonymous branches. Its the frequency of integration that matters.

nous,

gitflow != github flow

Gitflow is far more complex and unnessaray for most places. You do not need a dev, main, and release branches. Github flow is far closer to trunk based dev - create a branch of master, PR back into master when done. If you keep your PRs small it gives you most of the benefits of trunk based dev with a CI check before you merge to the mainline.

Sigmatics,

Source?

uniqueid198x,

Got asked about this twice so I’m cut/pasting my answer, but happy to discuss further

Check out the dora reports and the data Nicole Forsgren lays out in her book Accelerate. DORA reborts are free to access. She has found clear links between trunk based (no branching) development and a whole host of positive metrics. There is some suggestion that PRs are not too bad if always done at high quality and within the same day, but its weaker.

fusio,

what data? just curios because there are so many ways to do PRs properly… like for everything, if it’s done badly better not do it. does not mean it is inherently bad

uniqueid198x,

Check out the dora reports and the data Nicole Forsgren lays out in her book Accelerate. DORA reborts are free to access. She has found clear links between trunk based (no branching) development and a whole host of positive metrics. There is some suggestion that PRs are not too bad if always done at high quality and within the same day, but its weaker.

Sigmatics,

Depends how good you are at what you’re doing. I’d argue that humans err and it saves a bunch of time to catch bugs before debugging in the wild

apd,

Big hot take to me; especially in an organization with a large size and code high standard

fusio,

depends on the company/team culture. are other people gonna have to fix or extend code you wrote? are you the sole engineer working on entire modules? do you hate feedback?

TehPers,

You must trust your team’s abilities more than I trust my own. How often does your team merge bugs into main? We use CI primarily for running the full test suite, including integration tests and e2e tests that would be very difficult to run locally due to them using specific credentials to access testing resources.

vvv,

If your team consists of people you don’t trust, that’s the problem to fix first.

TehPers,

I trust my team. I don’t trust my or their ability to write and merge perfect code each time. I’m not sure how we’d fix that problem aside from becoming programming gods.

vvv,

My point is, having PRs desn’t result in perfect code either. They might help sometimes, maybe 10% of the time if I’m being generous, but the rest of the time they are a hindrance. The problems people tend to try and solve with them, validation and indoctrination are better solved with a good CD pipeline, and pairing sessions.

Templa,

Unless you have people that are known to delivery garbage code. Which is more common than you would imagine, lol.

vvv,

The solution to that is pairing - spending a few hours collaborating with, and teaching this person will get them up to speed much faster than asynchronously nitpicking their code.

tatterdemalion,
@tatterdemalion@programming.dev avatar

The only thing a GUI text editor can be better at than a terminal editor is making it easier to use the mouse.

exi,

That really is one hell of a hot take 😀

I for one really love the zoomed out preview on the right that has become popular in recent years.

jason-williams.co.uk/…/debugging_screenshot.png

Really hard to do in a terminal. If you have errors you can see very fast where they are located/clustered in the file and can already tell just by the shape of the program where it is.

Another example: GUI color picker directly in my editor as a tooltip above color values in css/html templates.

Another example: inline preview of latex or Template fragments.

tatterdemalion,
@tatterdemalion@programming.dev avatar

That really is one hell of a hot take

Yea well most of the comments in here are lukewarm takes so… there you go.

I for one really love the zoomed out preview on the right that has become popular in recent years.

I almost never navigate code based on its order or “shape” in the file. LSP-based symbol tagging or searching is way faster than scrolling. I guess you can click the spot on the preview that you need, but I refuse to reach for my mouse while editing text.

Really hard to do in a terminal. If you have errors you can see very fast where they are located/clustered in the file and can already tell just by the shape of the program where it is.

I use LSP integration to see a complete list of errors/warnings and jump to them.

Another example: GUI color picker directly in my editor as a tooltip above color values in css/html templates.

That’s for design, not text editing ;)

inline preview of latex or Template fragments.

I will use a latex or markdown language server that renders to a browser tab.

To be fair, I don’t do HTML/JS/CSS, so I bet VSCode or other GUI editors are great for that. But that’s specifically because you want to see something rendered. Most of the time you can just see it in an actual browser next to your text editor though.

stinodes,

I almost exclusively do front end, in exclusively nvim. Exactly like you say, just have a browser window (or 2) permanently open.

xigoi,
@xigoi@lemmy.sdf.org avatar

the zoomed out preview on the right

github.com/gorbit99/codewindow.nvim

GUI color picker directly in my editor

github.com/uga-rosa/ccc.nvim

inline preview of latex

github.com/jbyuki/nabla.nvim

spokenlollipop,

Not really what you’re after, but… Using a gui text editor means scrolling is usually smoother. Similarly, horizontal scrolling/wraparound experience is better.

Semi related: Did you know they the jetbrains IDEs have official vim-like key bindings? I converted a windows gvim user to it.

tatterdemalion,
@tatterdemalion@programming.dev avatar

scrolling is usually smoother

This is probably the last thing on my mind when editing text, but sure.

Did you know they the jetbrains IDEs have official vim-like key bindings? I converted a windows gvim user to it.

Yea I’m aware, but why would I use an emulator when I can use the real thing?

stinodes,

I don’t even think that’s the case, honestly. There are ways to make it animated smooth as well, and the scrolling is already more responsive and fast, and thus smooth.

Using vim keybinds in gui ide’s feels bad to me usually cause of how slow they tend to be.

xigoi,
@xigoi@lemmy.sdf.org avatar

I hate animations. I’m glad that scrolling is instant in Neovim.

morrowind,
@morrowind@lemmy.ml avatar

Conversly, I see nothing a TUI editor can do better than a GUI, including use of the keyboard

tatterdemalion,
@tatterdemalion@programming.dev avatar

Yea I think I agree with you there, at least theoretically. In practice I’ve found that it’s easier to use a TUI editor over SSH, and they require less resources, but that usually isn’t noticeable on my PC.

phoenixz,

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

SlikPikker,

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

Pervert.

phoenixz,

Yeah, why?

I know it’s popular to bitch on php but I’ve found it’s all for the wrong reasons. The vast majority of the internet still runs on it and it’s a breeze to work with, I love it. It’s safe, it’s fast, it’s great.

I’ve worked with a variety of JavaScript frameworks and they all give me headaches.

SlikPikker,

It’s just that it’s an ugly and weak language, overly verbose, and riddled with inconsistencies. There are few good things you can do in PHP without huge frameworks.

phoenixz,

Not sure what qualifies as ugly but I find PHP codes much easier to read than JavaScript (if that is what you meant)

If with weak you mean weak typed then you’re partially correct: most of it can be typed and ever since … I dunno, years ago, I’ve worked exclusively with strict typing. Things have improved considerably on that front

What part is verbose? Genuine curiosity

The inconsistencies are true. It’s also PHP’s strength that they kept everything like that and kept everything compatible. Every JavaScript framework I have worked with caused the weekly update nightmare headaches where 5 bugs were resolved, but now 10 more were added due to changing method calls. I hated it and I love PHP for at least keeping that consistency. Over time they have worked little by little to mitigate things but at the core, yes, you have function call inconsistencies. However, good editors these days for that for you and tell you the function name and give you the parameter order.

Then that there are few good things you can dowithout frameworks is nonsense.

If you want to do it right you use a framework, but that goes for every language. But I’ve sen and worked on (admittedly a horrible) system that would scrape millions of pages per day and its first version was just hacked together code. Ugly but super quick and simple, no frameworks. I’ve built many similar systems and sites like it over the years.

Now I recently built my own new framework in PHP, all strict, and it’s just fast and beautiful

SlikPikker,

You’re comparing to only JavaScript, have you worked with another language like python, ruby, lisp, rust? Maybe then you’d see what I mean.

By verbose I mean that mostly PHP lacks syntactic sugar, mostly it lacks powerful features of other languages. You can mostly write very simple procedural code.

phoenixz,

Well I compare to JavaScript because that’s what most people bring up. On web development, I guess JavaScript is the biggest competitor.

I’ve worked with many languages. I even worked with assembly for a while in another life over 25 years ago, I worked with visual basic, .net, c, c++, Java, JavaScript and it’s many frameworks, loads other more obscure languages too, and I’ve played with some python over the years. Still though, php has my favorite since a loooong time

Can you give an example of missing syntactic sugar or features that are missing?

SlikPikker,

Type hints and comprehensions as in Python, borrow checker, traits, code interface checking in Rust. Most functional features.

IDK; I just don’t like anything about PHP and I have worked with it. It seems bad at every task.

phoenixz,

Type hinting? There. Traits? There. Interfaces? There. I could go on but PHP has all these features that people keep saying are missing.

I’m not saying you don’t have to like PHP, everyone likes there own labgua and that’s fine.

However, people keep making shit up about phpt and then use that shit to smear it and it’s annoying. PHP is great for web sites, small and complicated, it’s great for command line scripting, it’s great for a large list of tasks and it seems that what you need is there.

SlikPikker,

It doesn’t really count if you need a huge framework for it. Frankly I never saw PHP used well, and I never saw it do anything better than other languages can do.

phoenixz,

It doesn’t need a huge framework for any of the things I mentioned.

I use my own (rather small still, really) framework to make things easier, like you’d do for any larger projects.

But I can (and have) on many occasions just slap something together as well

words_number,

Hahaha this is great! All points are basically entirely obvious and common sense and then you hit us with that ridiculous statement about PHP. Outrageous!

phoenixz,

From what I’ve seen is that 99% of the PHP hate is people parroting slogans others came up with, and the rest is that there are inconsistencies with the function signatures.

That last part is very true, of course, but not really an issue with modern editors as they will already tell you what’s expected. On the other hand, the inconsistencies are still there for a reason: compatibility. JavaScript what’s a nightmare to work with because every week an update would break shit because of changing method signatures in JavaScript packages. PHP always worked and remained working because it changed so little in that respect.

In all other areas it hugely improved and matured over the years, just like all programming languages.

So yeah, I find the PHP hate childish, really.

jvisick,

Honestly, “it’s better than JavaScript” is a pretty low bar.

I don’t like PHP because I think the syntax is ugly and I’ve only used it on systems that are old and a pain to maintain, but I’ll also very freely admit that I have absolutely not written enough PHP to have an informed opinion on it as a language.

phoenixz,

True enough on JavaScript but I mention it because people always take that for comparison. I’ve used it for hundreds of projects now and for me it’s become my default goto language because I can slap together anything with it. It now has good (optional but encouraged) type safety, which greatly improves code quality so yeah… love it

words_number,

PHP grew “organically” out of a perl library. There was never a consistent plan/idea about the set of abstractions it provides, the type system, builtin functions etc… Everything has been bolted on here and there, some additions good, some bad, some terrible pitfalls. A language with builtin operators that are basically unusable (comparison!) and where some functions return false when the input is invalid, is really fundamentally broken. I agree that many of the worst failures of PHP have been (kind of) fixed after PHP5 and that’s nice for large existing PHP codebases (mediawiki, wordpress, nextcloud, typo3). But I just can’t understand why one would start new projects in PHP in a world where so many very well designed and well thought through languages exist.

phoenixz,

Yes, PHPs beginnings were very messy and even today we see results from that.

But PHP was and remains hugely popular because it’s so easy and fast to work with and today it is very nicely designed and worked out. Yeah there are many details open but editors help you out with that. Other languages may be more consistent at the core but they have their own issues. JavaScript is a nightmare to work with for me, personally, but I o dont bitch about it every opportunity I get.

I guess I’m just slightly annoyed with people complaining about PHP while it’s just another language and it’s success speaks for itself

words_number,

Yes, JS is equally terrible! At least we can agree on that :-P

And I also understand that PHP (just like most technologies) can be very efficient to work with if you are used to it and know it very well.

phoenixz,

Well, if it comes to web development (my main focus since the last decade at least) I think it’s fair to say there is little that nears PHP (or, begrudgingly, JavaScript)in functionality. With current frameworks (my own included) I can churn out highly complicated and fast sites in no time. Can’t say that for many other languages.

Java? “Fast”? Lol no. “No time”? Lolol no.

Python? Honestly I have too little experience with it to say, but at least frameworkoptions are much more limited anyway

MaximumPower,

I don’t have issue with methods being 200 lines, as long as they have a singel concept and is easy to follow.

its_pizza,

If the method does a long thing, the keep it long. I do a lot of data analysis and simulation, and so often people who came before had this urge to shorten methods, so we get:


<span style="color:#323232;">def do_calculation(N, X, y, z, a, b, c):
</span><span style="color:#323232;">    # Setup stuff
</span><span style="color:#323232;">    for i in range(N):
</span><span style="color:#323232;">        calclation(X[i], y, z, a, b, c)`
</span>

Sometimes there’s a place for that, like if calculation could be swapped for a different function, or if calculation is used all over the program. It’s a pretty good clue that something is up though when the signatures are almost identical. Of course, that has just led to people writing:


<span style="color:#323232;">def do_calculation(big_struct):
</span><span style="color:#323232;">    read_data(big_struct)
</span><span style="color:#323232;">    calculate(big_struct)
</span><span style="color:#323232;">    write_data(big_struct)
</span>
phoenixz,

There are various exceptions where up to 200 lines is still okay, yes. The 50 lines rule is more a good rule of thumb.

Omgpwnies,

Your average Microsoft error “error 37253” is worthless to me

This is a security thing. A descriptive error message is useful for troubleshooting, but an error message that is useful enough can also give away information about architecture (especially if the application uses remote resources). Instead, provide an error code and have the user contact support to look up what the error means, and support can walk the user through troubleshooting without revealing architecture info.

Another reason can be i18n/l10n: Instead of keeping translations for thousands of error messages, you just need to translate “An Error Has Occurred: {errnum}”

BatmanAoD,

Those benefits both make sense, but are those really the original motivation for Microsoft designing the Blue Screen of Death this way? They sound more like retroactive justifications, especially since BSODs were around well before security and internationalization were common concerns.

phoenixz,

Linux has something similar, kernel panics. However, with Linux you get useful information dumped on your screen.

Nothing gets logged on Linux either, just like windows and that makes sense. The kernel itself messed up and can’t trust its own memory anymore. Writing to disk may cause you to fuck up your disk, so you simply stop everything.

Still though, Linux dumps useful info whereas windows just gives you this dumb useless code.

phoenixz,

Not when it’s my own computer. My computer needs to give me useful messages.If it’s a website then the site MUST log correctly in the log files…

If it’s a translation issue then just use English, everyone that can understand logs can (or at least should) understand that

zaphod,

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

If it doesn’t fit on my screen it’s too long.

r1veRRR,

PHP the language has become pretty nice, but I recently had to work with a PHP CMS deployment, and it was an absolute pain to do. PHP frameworks seem to still exist in a world where you manually upload code to a manually configured server running apache. Dockerizing the CMS (uses Symfony) is/was an absolute pain.

phoenixz,

I know that there are loads of solutions out there that can do this for you, though I don’t have much experience with it myself directly. Not a great fan of docker, still, as it’s not a requirement and in many cases that extra piece that fails and then is a PITA to fix.

I’ll look to include it in my own framework, though

Floey,

Write the whole thing, and only then, scrap it and rewrite it. This way you actually have a good understanding of the entire implementation when you are rewriting. When I refractor while writing my draft I will slow myself down and trip over myself, I’ll be way more likely to rewrite something I’ve already rewritten.

Sure there is a limit to the size of projects this can work for, but even for massive projects they can still be broken into decently sized chunks. I’m just advocating for not rewriting function A as soon as you finish function B.

MajorHavoc,

Write the whole thing, and only then, scrap it and rewrite it.

Exactly. And that’s the part a lot of folks don’t understand about writing tests. If we’re not sure an interface will survive into the rewrite, it probably doesn’t belong in the test suite.

And the rewrite can be very fast, if we tested the right things.

lefixxx,

I like 1-index because its what I learned first, and you like 0-index because that’s what you learned first

Weirdfish,

We just need to compromise, arrays start at 0.5

moreeni,

Peak centrism

warlaan,

My hot take: There is no such thing as 0-index. If you start with 1 it’s an index, of you start with 0 it’s an offset.

mindbleach,

I learned BASIC first, so… no.

And 0-index is what’s real. If you have ever touched hardware that’s 1-indexed, your retro hobbies are even more esoteric than mine.

257m,

I like 0 index because it is 2hat is used under the hood. The index is not really an index but rather an offset from the array pointer.

nomecks,

If you’re not a programming superstar you can probably make more money writing nothing but Terraform code for hapless enterprises.

lysdexic,

What’s wrong with automating processes?

nomecks,

Nothing.

Crisps,

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.

steventrouble,

Is that a hot take, though? Pretty much every major tech company and major university agrees.

NBJack,

You know, I wish it wasn’t. Much of Amazon was on a version of Perl for years (and may still be) for almost all of their front end hosting. Facebook has transformed PHP into Hack (which is better for types, though technically not strongly typed), strongly suggesting they were running PHP until 2014. Let’s not forget what WordPress is still in PHP too.

TechieDamien,

Not really a hot take. Why do you think most dynamic languages have the option to tack on static typing?

xigoi,
@xigoi@lemmy.sdf.org avatar

Depends on the community. In Lisp communities, for example, it’s very much a hot take. Which is a shame, because I’d love a statically typed Lisp-like language.

MashedTech,

We can feel it in our bones… And boy is it a pain when you find a huge codebase that is JS only or python without types. Fucking hell dealing with that shit

CodeBlooded,
@CodeBlooded@programming.dev avatar

Python, and dynamically typed languages in general, are known as being great for beginners. However, I feel that while they’re fun for beginners, they should only be used if you really know what you’re doing, as the code can get messy real fast without some guard rails in place (static typing being a big one).

Herrmens,

Disagree on this one, even though I can see where you are coming from. I first learnt programming in Java, and it gave me massive problems to understand the structure and typings. Obviously Java isn’t the most beautiful language anyways, but once I picked up python it started to click for me on how to solve problems, because I didn’t have to think about that many things. I could just go for it. Yes, my code was messy in the beginning, but I wasn’t working on any important projects. It was just for fun.

So I think learning how to solve problems is as important as writing clean code. And python really helped me with that.

Swiggles,

Python is stupid. Using non printable characters as anything other than token separation is just asking for trouble.

Sigmatics,

Just use a modern editor and you’ll never have this problem

Swiggles,

You can work around most issues in any language with the right tools. That’s not the point.

If a design decision introduced a whole new class of errors it is probably just bad design.

Sigmatics,

It’s a choice, do you want to deal with brackets or indents? Pick one

Sigmatics,

It’s a choice, do you want to deal with brackets or indents? Pick one

dudinax,

It also greatly improved readability of the language. Since switching to the standard of using 4-space tabs, I’ve not had any problems except when dredging up someone’s old Python 2 code.

nous,

You can create some really ugly code in spite of the forced indentation in python. Indentation does not really help here at all. In all languages you can correctly or incorrectly format things. A code formatter strictly applying a coding standard helps far more here than indents vs bracers. Take a look at black it takes the pep8 standards and adds more strict things on top making code look a lot more consistent and thus makes it easier to read.

And all formatters will indent code consistently, so having it as part of the language parser does not really help improve readability at all. And even without a formatter everyone I know will still correctly indent their code no matter the language used. But sometimes forcing new lines to have a meaning does make things worst - just look at pythons lambdas which have to be a single line.

Reptorian,

Indentations does not really help readability that much in case of really, really, long code, and in some cases, a code can execute without with unexpected result because of one single indentation being off. Both of these why I like things like curly braces/brackets and terminators like endif/fi/done/end/etc. But, at the end of the day, if there’s a readability problem, then that’s a sign that the code needs to be reworked on.

nous,

Oh I think indentation helps a ton with readability. Even for bad, long or otherwise hard to read code - it would be way, way worst with no or wrong indentation. Correct indentation helps a lot. It is not the only thing that can be done to improve readability but it is the first and simplest fix you can apply to a code base. So a language enforcing it with syntax does not matter when even basic text editors can correctly and automatically indent your code.

Reptorian,

I didn’t say it doesn’t help. But, it alone does not really help for bad and long code, but you are correct in that it would be worse with the wrong indentation. Like you pointed out, the program could do the wrong thing if there is a wrong indentation where indentation matters which is one of my issue with something like Python. And languages with explicit exit scope tend to not have that issue while adding to the benefit of making longer code readable. Where white-space sensitive languages really shine on in my opinion are small codes, and that’s where I think of using Python.

xigoi,
@xigoi@lemmy.sdf.org avatar

Indentation can be wrong, but braces can’t?

Reptorian,

Braces too can be wrong. But, one is less likely to get it wrong. Modern editors often allows one to highlight matching braces immediately after selection, and rainbow braces(if available) makes it clear on the nest level.

xigoi,
@xigoi@lemmy.sdf.org avatar

The space is a printable character.

What trouble have you gotten into due to this?

Swiggles,

Just copy some code over into a not properly configured vim.

People seem to forget that not everything is a fully configured development environment working locally on your laptop which attempts to fix the issues introduced by that design decision.

xigoi,
@xigoi@lemmy.sdf.org avatar

I use (Neo)Vim and never had a problem with indentation. When pasting code, I can easily indent it to any level I want with the > operator.

Swiggles,

Which actually breaks the code if you don’t have sw configured to the same width as used by the code.

If anything that proves my point.

premavansmuuf,

Is Haskell, YAML, or Sass also stupid? 🤔

Swiggles,

Absolutely yes. JSON and SCSS > YML and SASS

OsrsNeedsF2P,

YAML can die in a fire, thanks

Crisps,

Add YAML to that for the same reason.

Swiggles,

Actually I did below! You are absolutely correct.

akselmo,

I actually like C.

Kolanaki,
@Kolanaki@yiffit.net avatar

I’m not a professional programmer, I just do mods mostly; C is too common. It was the first language I really used, too. I mean, I learned BASIC first but I didn’t use it for anything outside of learning.

257m,

Me too. It’s the only language felt natural. Learning it was a breeze and I haven’t needed anything it dosen’t provide.

xigoi,
@xigoi@lemmy.sdf.org avatar

You’ve never needed an array whose size is not known at compile time?

257m,

Dynamic Memory Management exists.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines