Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



In more tales from Ember at work, it turns out Ember-cli works pretty well until you want to use an add-on and then everything gets a little worse for you.

We're using an addon for using AMD require (ArcMap JS uses it because it uses Dojo and Dojo uses it), one for using pod-style file conventions for CSS (instead of the ridiculous default way that Ember uses which is split by type), and a few others just for help here and there. The one thing they have in common is that they don't have a lot written about them, they usually don't have great overviews of their configuration options, and most predominant is that they never say which versions of Ember/Ember-cli they work with.

I spent a while trying to update the AMD addon and running in to an error from Ember-cli with the helpful message "cannot use 'js' on undefined". Nothing on the github for the AMD addon of course, and they never say which versions they support, and at one point in the versions past the one we're using (we haven't upgraded in a couple of months) they redid all the configuration options and didn't tell you how to migrate them.

Anyway I ended up using node-inspector which is a piece of poo poo to find out what that error is coming from and it turns out that at some point between Ember-cli 1.13.8 and 1.13.15, another property was being added to a random property that the updated AMD addon was trying to access. So I've discovered that AMD addon version whatever requires Ember-cli version whatever and doesn't say anything. I go to update Ember-cli a few patch versions ahead (not even minor, just patch) and then I get another random cryptic error this time about CSS. I reverted my changes back, made sure all of the software on my computer was the same way it was before, and I'm pretending I never touched any of it so hopefully my boss will be the one to update all of this poo poo instead of me.

Adbot
ADBOT LOVES YOU

Volguus
Mar 3, 2009
Holy poo poo, is the payoff that big that its worth it? This screams "runaway little girl, run away" from kilometers ahead. I mean, to build one's entire stack on something like javascript is incomprehensible to me but understandable when the promised payoff is bigger than the investment. But when that ugly lie is showing its big ugly head ... why go on? The entire show is built on a house of cards anyway. Kill it, shove a stake through its heart and walk away never looking back.

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Volguus posted:

Holy poo poo, is the payoff that big that its worth it? This screams "runaway little girl, run away" from kilometers ahead. I mean, to build one's entire stack on something like javascript is incomprehensible to me but understandable when the promised payoff is bigger than the investment. But when that ugly lie is showing its big ugly head ... why go on? The entire show is built on a house of cards anyway. Kill it, shove a stake through its heart and walk away never looking back.

Ember and Ember-cli themselves seem pretty decent at this at least. Every Ember version has warnings for future deprecations, and a good changelog, and Ember-cli itself probably has a decent upgrade path and ways to get help.

It's the addons that let you customize things that you can really hang yourself with so I would recommend having as little of those as possible.

Ember is clumsy at times but not that bad and I didn't like it going in but I don't think it's so bad (aside from, you know, the big post). I'd prefer something like Typescript+React+Webpack which should be a lot better about letting you upgrade things though.

Storysmith
Dec 31, 2006

piratepilates posted:

(ArcMap JS uses it because it uses Dojo and Dojo uses it),

ArcGIS's JS stuff is how I discovered that I am constitutionally incapable of being a JavaScript/front end developer. So in that way, uh, thanks, ArcGIS?

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



ArcGIS JS has a nice map but is kinda weird and uses Dojo for god knows what reason, that's why I'm glad the part of the application that I work on is the non-map part of it!

sunaurus
Feb 13, 2012

Oh great, another bookah.
I always think that JavaScript is a coding horror. I really like TypeScript though (and Dart, but nobody uses it).

I have a (large) project at work which used to be a JavaScript project but it is incrementally being "upgraded" to TypeScript. It's going pretty good but for the first few months there were a few devs who kept writing either normal JavaScript or just using the 'any' type for everything. It sucks when people are actively working against improvements.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Spotted yesterday in the jungle of old code:

code:
public sub CreateSeparateDocuments(someArgs)
    for i = 1 to 2
        select case i
            case 1
                CreateDocument(someArgs, someOption:=False)
            case 2
                CreateDocument(someArgs, someOption:=True)
        end select
    next
end sub

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

NihilCredo posted:

Spotted yesterday in the jungle of old code:

code:
public sub CreateSeparateDocuments(someArgs)
    for i = 1 to 2
        select case i
            case 1
                CreateDocument(someArgs, someOption:=False)
            case 2
                CreateDocument(someArgs, someOption:=True)
        end select
    next
end sub

I saw this style a few days ago as well. I'd always heard legends, but never imagined I'd see it myself.

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Illegal Move posted:

I always think that JavaScript is a coding horror. I really like TypeScript though (and Dart, but nobody uses it).

I have a (large) project at work which used to be a JavaScript project but it is incrementally being "upgraded" to TypeScript. It's going pretty good but for the first few months there were a few devs who kept writing either normal JavaScript or just using the 'any' type for everything. It sucks when people are actively working against improvements.

TypeScript is very nice and really should be mandatory for any new JavaScript project.

I really wish that the Ember team would pick up TS as a first class thing to support but they have not done so :( at least in the project I'm working at it hasn't really become an issue.

Qwertycoatl
Dec 31, 2008

Volmarias posted:

I saw this style a few days ago as well. I'd always heard legends, but never imagined I'd see it myself.

The best one I've seen in real life looked like this:
code:
alphabet = []
for (i in [1..26])  {
     switch (i) {
       case 1:
              alphabet.append("A")
       case 2:
              alphabet.append("B")
       .....
       case 26:
              alphabet.append("Z")
    }
}

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Qwertycoatl posted:

The best one I've seen in real life looked like this:
code:
alphabet = []
for (i in [1..26])  {
     switch (i) {
       case 1:
              alphabet.append("A")
       case 2:
              alphabet.append("B")
       .....
       case 26:
              alphabet.append("Z")
    }
}

The best part is you know whoever wrote this started at 'Well I can't just write alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ...'

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
2 or more letters, use a for...

Amberskin
Dec 22, 2013

We come in peace! Legit!

Qwertycoatl posted:

The best one I've seen in real life looked like this:
code:
alphabet = []
for (i in [1..26])  {
     switch (i) {
       case 1:
              alphabet.append("A")
       case 2:
              alphabet.append("B")
       .....
       case 26:
              alphabet.append("Z")
    }
}

I found this some time ago:

code:
    SELECT(A)
        WHEN(1) B=1;
        WHEN(2) B=2;
        OTHERWISE B=A;
    END;
The funny part was when I replaced this poo poo with B = A the program started to crash, because there was a misassigned array operation some dozens of lines below, and when the relative offsets changed it surfaced...

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

NihilCredo posted:

Spotted yesterday in the jungle of old code:

code:
public sub CreateSeparateDocuments(someArgs)
    for i = 1 to 2
        select case i
            case 1
                CreateDocument(someArgs, someOption:=False)
            case 2
                CreateDocument(someArgs, someOption:=True)
        end select
    next
end sub

High chance this is from a greybeard who accrued their spite emitting time-sliced cooperative crap on embedded microcontrollers.

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Volguus posted:

Holy poo poo, is the payoff that big that its worth it? This screams "runaway little girl, run away" from kilometers ahead. I mean, to build one's entire stack on something like javascript is incomprehensible to me but understandable when the promised payoff is bigger than the investment. But when that ugly lie is showing its big ugly head ... why go on? The entire show is built on a house of cards anyway. Kill it, shove a stake through its heart and walk away never looking back.

Also people on twitter are now disagreeing with me that ember-cli addons are hard to upgrade so who knows maybe I'm just a dummy or the ones I'm using are bad ones out of the bunch or something.

I mean we all know that's not true, but maybe.

canis minor
May 4, 2011

In Smarty:

code:
<ul>
{foreach from=$something item=item name=items}
{if $smarty.foreach.items.first || $smarty.foreach.items.index % 2}
<li>
{/if}
<div></div>
{if $smarty.foreach.index.last || !$smarty.foreach.items.index % 2}
</li>
{/if}
{/foreach}
</ul>
because why do consistent, n-able templates. Of course then n changed to 3 instead of 2, and some people were surprised the template broke (when they changed the 2 to 3, without changing anything else)

(I'm omitting the entire discussion why the gently caress this is not handled by css and :nth-child(n+x) selector)

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.
Delimiting lists is one of those fun challenges every programmer has their own buggy solution for.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

SupSuper posted:

Delimiting lists is one of those fun challenges every programmer has their own buggy solution for.

We have some internal protocols that have as many as 10 delimiters to define fields, sub fields, subsub fields and so on to pass around arguments as strings. And most of them include functions to define more delimiters if needed and pass them to the receiver ahead of the message so you can parse your bespoke 50 layers nested data object correctly at the other end.

brap
Aug 23, 2004

Grimey Drawer
If you have a condition in your template more complex than {% if model.isButt %} ... {% endif %}, that is kinda hosed.

Ika
Dec 30, 2004
Pure insanity

While tracking down the source of a newly introduced error I found this beauty

code:
	[...]
	if(item1st)
		this->doActivateItem(item1st);
	else
		if(itemlst)
			this->doActivateItem(itemlst);
At first glance it looks like it just has a useless if / else, but those are actually two different variables.

Ika fucked around with this message at 15:03 on Feb 23, 2016

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Also that's presumably an else if, not an else with an if therein as suggested by the shamefully unbraced indentation. Good concentration of horror there!

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Ika posted:

While tracking down the source of a newly introduced error I found this beauty

code:
	[...]
	if(item1st)
		this->doActivateItem(item1st);
	else
		if(itemlst)
			this->doActivateItem(itemlst);
At first glance it looks like it just has a useless if / else, but those are actually two different variables.

itemFirst and itemList, yes?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

pokeyman posted:

Also that's presumably an else if, not an else with an if therein as suggested by the shamefully unbraced indentation. Good concentration of horror there!

Same thing, no? "else if" isn't a distinct construct in C-family languages.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

LeftistMuslimObama posted:

itemFirst and itemList, yes?

Since the same method is called with each one, I doubt it takes either an item or a list, so my guess would be itemLast.

Ika
Dec 30, 2004
Pure insanity

Flobbster posted:

Since the same method is called with each one, I doubt it takes either an item or a list, so my guess would be itemLast.

Exactly. Somewhat earlier in the code it has
code:
	idx1st--;
	idxlst++;
The code iterates over a vector of potential candidates, I'm very tempted to rename the loop variable from i to idxIst.

It also doesn't even need to remember two different items, while the second item is always retrieved even if the first item is not NULL, it never is used in that case. So it could just use a single variable to store the target item and have the if/else there.

Ika fucked around with this message at 17:58 on Feb 23, 2016

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

LeftistMuslimObama posted:

itemFirst and itemList, yes?

There's no way that wasn't done on purpose, though.

Horse Clocks
Dec 14, 2004


Started work at a new client, and holy gently caress there's rules and documentation for everything you can be a pedant about, but seemingly none about "how to actually get poo poo done (that has business value)".

One thing I can't get my head around. Is their review and merging strategy. They do mandatory pull requests through github, but you're not to merge anything to master that couldn't be done as a fastforward (but don't actually fastforward). So once your code is reviewed, you practically throw away any documentation or discussion that may have been in the pull request.

Which leads me to. What's wrong with merging? Is following a commit graph that hard?

TURTLE SLUT
Dec 12, 2005

Horse Clocks posted:

Which leads me to. What's wrong with merging? Is following a commit graph that hard?
There's arguments for and against - some people say the information about merged branches is not worth the harder to read commit history, some people say it's vital. Some tools also don't handle a complicated merge history that well. I'm sure someone in this thread has a very strong opinion for either side!!

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



piratepilates posted:


and I'm pretending I never touched any of it so hopefully my boss will be the one to update all of this poo poo instead of me.

Bad news: My boss asked me to take a look in to upgrading ember-cli, the son of a bitch.

Good news: I somehow figured it out. After upgrading ember-cli and hoping it worked, upgrading all of the addons and hoping it worked (and trying to dig through git repos to see if they changed anything), running in to issues after updating everything, and running node-debug (gently caress node-debug) to try and figure what all the issues were I got it running (except for ember deprecations in our code that's on us and I am fine with).

Somehow ember-cli-sass was an older version that conflicted with ember-component-css? Somehow an animation library addon was conflicting with ember-component-css? For some reason you can't just import css files in your scss file with this new version of ember-cli-sass? For some reason ember-cli-sass (the highest rated SASS addon and apparently the best one for SASS in ember) does not have a changelog or any information on what changes between releases (but does have a release list with the release numbers)?

Horse Clocks
Dec 14, 2004


JOHN SKELETON posted:

There's arguments for and against - some people say the information about merged branches is not worth the harder to read commit history, some people say it's vital. Some tools also don't handle a complicated merge history that well. I'm sure someone in this thread has a very strong opinion for either side!!
both arguments for most practical situations sound like you can't use your tools properly.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Bisecting is more annoying if you have a non-linear graph, IMO.

Steve French
Sep 8, 2003

Horse Clocks posted:

They do mandatory pull requests through github, but you're not to merge anything to master that couldn't be done as a fastforward (but don't actually fastforward). So once your code is reviewed, you practically throw away any documentation or discussion that may have been in the pull request.

This doesn't follow for me. Presumably if your PR cannot be fast-forwarded as is, you would rebase it on current master so that it can be. This seems like the only way in which this would "throw away" documentation or discussion would be that github hides comments if the line they comment on change, so if during your rebase there were conflicts, those comments might be hidden. But that can also happen if you just add more commits that change those lines, which you would if you were responding to a request to change something.

Is the policy that instead of rebasing the PR branch, you instead create a new branch and PR and merge that?

What am I missing?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Subjunctive posted:

Bisecting is more annoying if you have a non-linear graph, IMO.

From what I can tell, git-bisect doesn't even bother checking anything but the first parent of a merge, too.

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

Horse Clocks posted:

Which leads me to. What's wrong with merging? Is following a commit graph that hard?
In my experience programmers aren't super tidy about their commits, and merge branches become less "visually informative" and more "horrible rats' nest", specially if you're doing everything via pull requests.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Plenty of people, programmers and non-programmers alike, go :psypop: if they have to deal with any kind of nonlinear commit history. Just because Git makes it possible doesn't mean that you should make use of it on a regular basis, if only to save the poor fragile brains of your users.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

SupSuper posted:

In my experience programmers aren't super tidy about their commits, and merge branches become less "visually informative" and more "horrible rats' nest", specially if you're doing everything via pull requests.

I make lots of local, incremental commits when I'm working. Not all of them will pass the test suites or even necessarily compile fully or on all platforms. I think it's a reasonable position to take that the shared repository shouldn't knowingly contain commits that are broken in those ways (and it's worth substantial investment to make sure that it's prevented).

Horse Clocks
Dec 14, 2004


Steve French posted:

This doesn't follow for me. Presumably if your PR cannot be fast-forwarded as is, you would rebase it on current master so that it can be. This seems like the only way in which this would "throw away" documentation or discussion would be that github hides comments if the line they comment on change, so if during your rebase there were conflicts, those comments might be hidden. But that can also happen if you just add more commits that change those lines, which you would if you were responding to a request to change something.

Is the policy that instead of rebasing the PR branch, you instead create a new branch and PR and merge that?

What am I missing?

Work -> Rebase -> Pullrequest -> Fix -> Rebase -> Merge

Your second rebase, which is inevitable on any project with any velocity, ends up changing the commit IDs. Which is fine, if nothing refers to your old commit id's. But the PR and associated code-comments on github do. Sure, they're still in there ~somewhere~ but they're pretty much lost as far as being recoverable goes.

And if your fix involves rebasing off master to make use of some other developers work, you've got three rebases.

[edit] It probably wouldn't be a problem if git kept a track of rebases, cherry-picks, squash-commits and other rewrites.

Horse Clocks fucked around with this message at 23:25 on Feb 23, 2016

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Horse Clocks posted:

And if your fix involves rebasing off master to make use of some other developers work, you've got three rebases.

Rebases are easy though, in the vast majority of cases.

Sedro
Dec 31, 2008

Horse Clocks posted:

Work -> Rebase -> Pullrequest -> Fix -> Rebase -> Merge

Your second rebase ends up changing the commit IDs. Which is fine, if nothing refers to your old commit id's. But the PR on github does. Sure, they're still in there ~somewhere~ but they're pretty much lost as far as being recoverable goes.

And if your fix involves rebasing off master to make use of some other developers work, you've got three rebases.
I don't get it. That's a standard github workflow.

The PR refers to the repo/branch, not the commit hash. So you rebase and force push to your branch, which updates your PR

Adbot
ADBOT LOVES YOU

Horse Clocks
Dec 14, 2004


Sedro posted:

I don't get it. That's a standard github workflow.

The PR refers to the repo/branch, not the commit hash. So you rebase and force push to your branch, which updates your PR
You are right.

It looks like all of my irritation/confusion stems from the teams use of commit/line comments to do any PR discussion as opposed to against the PR itself.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply