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
Strong Sauce
Jul 2, 2003

You know I am not really your father.





Use javascript, get yelled at for using the wrong programming language.

Switch from javascript, get yelled at for being a programming hipster...

Adbot
ADBOT LOVES YOU

jony neuemonic
Nov 13, 2009

eithedog posted:

Um... This is the result - seeing that most people do any JS dev without any sort of OO in mind.

Oh, I agree. That's why I don't think that quote (or being frustrated with Node's emphasis on performance over everything else) is unreasonable.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Strong Sauce posted:

Use javascript, get yelled at for using the wrong programming language.

Switch from javascript to a hipster language because you're too stubborn to use something popular and well-supported like Python, Java, or C#, get yelled at for being a programming hipster...

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Strong Sauce posted:

Use javascript, get yelled at for using the wrong programming language.

Switch from javascript, get yelled at for being a programming hipster...

Yes, this is the objection, it's definitely not because some people choose platforms only to be seen using trendy languages.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
e: I don't want to be part of the problem here

Suspicious Dish
Sep 24, 2011

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

eithedog posted:

Um... This is the result - seeing that most people do any JS dev without any sort of OO in mind.

(Apologies if your objects / libs are nicely structured instead of being a bunch of closures within closures within closures )

I'm always curious if my JS code is good enough and readable enough. I have a very unique code style in my JS, and I use it for a lot of large, insane projects.

This is my OOP style:

https://github.com/magcius/xplain/blob/gh-pages/src/server/server.js

This is my non-OOP style:

https://github.com/magcius/bmdview.js/blob/gh-pages/bmd.js

The Insect Court
Nov 22, 2012

by FactsAreUseless

fidel sarcastro posted:

That quote isn't so unreasonable, isn't one of the major problems with Node that it's easy to write fast but hard to maintain code?

That's a problem with Javascript more generally. it's a pain in the rear end to do programming "in the large". No real module support or namespacing, weird scoping rules, crippled OO, and annoyingly permissive semantics. Plus the lack of support for doing concurrency and async other than ugly hand-rolled continuation passing. Node is actually surprisingly fast, general faster than other interpreted languages. It can be competitive with a lot of the big compiled ones.

Besides, the "right language" for a critical line of business app is the one your developers already all know, for which there's a mature toolchain, and which is performant enough. The right language for your lovely little side project that will decay on Github after hitting v0.0.2 is whatever you want it to be.

ExcessBLarg!
Sep 1, 2001

Sagacity posted:

Looks like Go is now the next language for the Rails/NodeJS hipsters to flock to. I wonder when they'll arrive at a language that has a strong type system.
So the OP is actually a great post. His comments on Node's terrible error handling is exactly what's wrong with Node when used for non-trivial projects, the kind of stuff that most noders just ignore.

Westie
May 30, 2013



Baboon Simulator

ExcessBLarg! posted:

So the OP is actually a great post. His comments on Node's terrible error handling is exactly what's wrong with Node when used for non-trivial projects, the kind of stuff that most noders just ignore.

Node.js has the worst error handling - but it is .js so what do we expect :(

The hardest part of node.js is making sync handling for multiple async actions, I haven't yet come across a decent library that helps w/ that.

Captain Capacitor
Jan 21, 2008

The code you say?

Westie posted:

Node.js has the worst error handling - but it is .js so what do we expect :(

The hardest part of node.js is making sync handling for multiple async actions, I haven't yet come across a decent library that helps w/ that.

I've had luck with this library. Takes a moment to wrap your brain around certain things but it works pretty well.

Westie
May 30, 2013



Baboon Simulator

Captain Capacitor posted:

I've had luck with this library. Takes a moment to wrap your brain around certain things but it works pretty well.

async.parallelLimit is what I want. Thank you!

TheresaJayne
Jul 1, 2011
I have been doing some coding for minecraft mods, which are usually coded by complete novices who plough through examples until their code does what they want it to.

One thing i have noticed more than anything in their code

code:
String one;
String two;
String three;

String one = "Hello ";
String two = "World!";
String three = " Dilbert";

public String doSomething()
{
  String one = (String)one + (String)three + (String)two;
}

Specifically they cast EVERYTHING whether it needs it or not.

Hiowf
Jun 28, 2013

We don't do .DOC in my cave.

TheresaJayne posted:

I have been doing some coding for minecraft mods, which are usually coded by complete novices who plough through examples until their code does what they want it to...
Specifically they cast EVERYTHING whether it needs it or not.

http://pragprog.com/the-pragmatic-programmer/extracts/coincidence

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

TheresaJayne posted:

I have been doing some coding for minecraft mods, which are usually coded by complete novices who plough through examples until their code does what they want it to.

To be fair a lot of Minecraft mods appear to involve literal 12 year olds.

Queen of Beans
Jun 15, 2007
I wasted far too much time today hunting down a reference issue.

I was developing in Solution A, which threw a MissingMethodException deep in our DB layer when installed on a QA machine. Turns out that our main ORM project (home grown, of course) was referencing the buiid output of Solution B, which again had a file reference to the wrong version of the DB layer. The installer was installing the right version then overwriting with the wrong version.

Took me FAR too much digging with AsmSpy to find it. and it would really help if people had ever bumped version numbers in anything ever.

Oh well, only a couple of weeks left.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

hobofood posted:

I wasted far too much time today hunting down a reference issue.

I was developing in Solution A, which threw a MissingMethodException deep in our DB layer when installed on a QA machine. Turns out that our main ORM project (home grown, of course) was referencing the buiid output of Solution B, which again had a file reference to the wrong version of the DB layer. The installer was installing the right version then overwriting with the wrong version.

Took me FAR too much digging with AsmSpy to find it. and it would really help if people had ever bumped version numbers in anything ever.

Oh well, only a couple of weeks left.

Installers are a terrible idea for anything that's not user-facing. Ideally, you'd have automated builds and releases where this kind of thing would pop right out at you. Binary reference where you should be using a project reference? Build failure.

Queen of Beans
Jun 15, 2007

Ithaqua posted:

Installers are a terrible idea for anything that's not user-facing. Ideally, you'd have automated builds and releases where this kind of thing would pop right out at you. Binary reference where you should be using a project reference? Build failure.

This would be lovely, but my boss not a very smart or forward thinking kinda guy, so the chances of any kind of CI is just thrown out the window.

The app isn't actually for users, it's for headless machines and is essentially just a couple of Windows services talking to each other over WCF, which made deployment even more fun.

But yeah, the place sucks, the processes don't even exist to suck and it's all held down with arbitrary rules ("Don't use MVC, it doesn't scale", "WebAPI is a complete mess so don't use that either", "A shared Outlook inbox is more than enough for a Helpdesk team of 3 people", "3 Helpdesk/QA staff is more than enough for 18 devs" and "Serialization sucks because it [CPU and memory load] kills web servers"), so I did the whole YOTJ thing a couple of months back and am just working through my notice period before starting a new job with a Gold partner who are paying me nearly 2x as much.

Edit: Forgot my favourite feature of the whole job! Visual SourceSafe 6.0 for EVERYTHING. I'm surprised it even supports long filenames.

Queen of Beans fucked around with this message at 20:48 on Jul 7, 2014

pigdog
Apr 23, 2004

by Smythe

hobofood posted:

This would be lovely, but my boss is the boss that doesn't like Serialization because "it [CPU and memory load] kills web servers", so the chances of any kind of CI is just thrown out the window.
:what:

That sentence doesn't make any sense.

Queen of Beans
Jun 15, 2007

pigdog posted:

:what:

That sentence doesn't make any sense.

Sorry, wasn't trying to say that CI requires Serialization, I was calling my boss a stupid dick

tef
May 30, 2004

-> some l-system crap ->

TheresaJayne posted:

I have been doing some coding for minecraft mods, which are usually coded by complete novices who plough through examples until their code does what they want it to.

Specifically they cast EVERYTHING whether it needs it or not.

This is the problem of stricter languages, people tend to ward off errors rather than understand them. In java i've also seen people peppering "static" in front of methods to make all the compile time errors go away. Meanwhile in Python, i've seen .encode().decode().encode() to try and keep UnicodeDecodeError at bay

i'm unsure of what the moral is, but it's something along the lines of "unless you explain the error well enough, people will cargo cult around the problem. if you can explain the error well enough, why can't you just do the right thing"

Deus Rex
Mar 5, 2005

Yeah, you see this in Rust where people just call unwrap on Result instead of pattern matching and explicitly handling the Err case. If there weren't unwrap, then people would have to explicitly state a failures like:

code:
let val = match some_io_operation() {
    Ok(v) => v,
    Err(_) => fail!("wow I'm a dummy and failing instead of handling this error") 
    // or a "stronger" assertion like unreachable!() or whatever
};
// ...
which makes it a little clearer how careless the code potentially is.

Workaday Wizard
Oct 23, 2009

by Pragmatica
I was looking for the documentation of unwrap() and wow... Rust's documentation got a really nice upgrade in quality and quantity.

Volmarias
Dec 31, 2002

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

hobofood posted:

Edit: Forgot my favourite feature of the whole job! Visual SourceSafe 6.0 for EVERYTHING. I'm surprised it even supports long filenames.

Trigger warning! :gonk:

I last used VSS 6 in TYOOL 2008. I cannot believe that anyone is still using that. Did your boss not get the memo that it's been EOL'd?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Volmarias posted:

Trigger warning! :gonk:

I last used VSS 6 in TYOOL 2008. I cannot believe that anyone is still using that. Did your boss not get the memo that it's been EOL'd?

I'm actually surprised that mainstream support only ended in 2012. VSS was so unimaginably terrible.

Volmarias
Dec 31, 2002

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

Ithaqua posted:

I'm actually surprised that mainstream support only ended in 2012. VSS was so unimaginably terrible.

I like to think that someone at microsoft was reminded in 2010 that people still used it, said "oh poo poo, did we ever EOL that thing?" and then got on it. The wiki page said that a patch in 2005 added unicode support, but that was the last time it was updated.

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

tef posted:

This is the problem of stricter languages, people tend to ward off errors rather than understand them. In java i've also seen people peppering "static" in front of methods to make all the compile time errors go away. Meanwhile in Python, i've seen .encode().decode().encode() to try and keep UnicodeDecodeError at bay

i'm unsure of what the moral is, but it's something along the lines of "unless you explain the error well enough, people will cargo cult around the problem. if you can explain the error well enough, why can't you just do the right thing"

I've seen this in C# where the compiler won't let you return nothing from a function, or use an unassigned value, so people will return/assign nonsensical values to things in unexpected code paths (like the default case of a case statement) to shut the compiler up, when they should be throwing an exception. I've come across some annoying and difficult to track down bugs that had their source in this sort of crap. Maybe the compiler should suggest throwing an exception as a possible solution, I'm not sure a lot of people are aware of it.

Edit: In the spirit of the thread and since it's a horror in multiple ways I'll include an example that screwed me over. We had some software that talked to some hardware. There were a bunch of register names and associated addresses. In what was already a horror there was in essence a lookup table for register addresses implemented with a case statement. This code was generated. So you'd have this function that looked like:

code:
int getAddress(string registerName) {
	switch(registerName) {
		case "registerA":
			return 0x04;
		case "registerB":
			return 0x08;
		...

	}
}
But you need to cover all paths in C#. So whoever was writing this, almost certainly in an attempt to shut the compiler up, added the following:
code:
		default:
			return 0;
(Unfortunately people have a tendency in this sort of situation to go with a "defaultly" feeling value even if in actuality it makes no sense) So if the register you were looking for didn't exist (or you misspelled the name) then it would silently return an actual address you could read and write to! After some frustration with some bug I noticed that the value I was writing to one register was showing up in the other, because they actually were reading/writing to the same address, which eventually allowed me to track that bug down to this code. Had they just thrown a drat exception instead it would have saved me hours of time.

HappyHippo fucked around with this message at 05:23 on Jul 8, 2014

TheresaJayne
Jul 1, 2011
I dont get the pragmatic programmer link....

I get defensive coding but doing something like

code:
Player player = (Player)(new Player());
is just insane.

Hiowf
Jun 28, 2013

We don't do .DOC in my cave.

TheresaJayne posted:

I dont get the pragmatic programmer link....

I get defensive coding

It's not defensive coding. These people have literally no idea what they're doing. But they saw the cast in an example, at some point their code started working when they added the cast, so now they add casts everywhere, because casts make your code work.

Suspicious Dish
Sep 24, 2011

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

tef posted:

Meanwhile in Python, i've seen .encode().decode().encode() to try and keep UnicodeDecodeError at bay

Part of the problem is that adding a .encode() on a str object can make a UnicodeDecodeError appear out of nowhere, because Python 2's model is quite insane like that. And unicode and str objects look very similar to human inspection. So unless you understand .encode() and .decode() and what your types are, it's very easy to get confused.

The model made itself hard to debug and hard to understand, because trying one thing brings something nonsensical out.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Suspicious Dish posted:

Part of the problem is that adding a .encode() on a str object can make a UnicodeDecodeError appear out of nowhere, because Python 2's model is quite insane like that. And unicode and str objects look very similar to human inspection. So unless you understand .encode() and .decode() and what your types are, it's very easy to get confused.

The model made itself hard to debug and hard to understand, because trying one thing brings something nonsensical out.

I didn't understand Unicode for the longest time because Python 2 had polluted my brain with its insanity.

Pollyanna
Mar 5, 2005

Milk's on them.


Are we still doing those Github links?

https://github.com/search?q=viod&type=Code&ref=searchresults

code:
/*
 * - (void)test
 */

- (void)anotherTestThing
+ (viod)thisisatest

notatest

NFX
Jun 2, 2008

Fun Shoe
I did a search for "unsinged", but most of the hits were just copies of a unit test for Clang's error parser.

Spatial
Nov 15, 2007

At work I'm designing and implementing a language from scratch. Syntax, opcodes, virtual machine, compiler, everything is totally up to me.

The VM must fit in less than 768 bytes of memory.

I am become death, destroyer of minds :unsmigghh:

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Spatial: Color me intrigued. Can you share any other details? What sorts of programs will the VM need to be capable of running?

Spatial
Nov 15, 2007

It's for an embedded radio transceiver that runs off a little battery. Normally there's a host CPU which controls what it does, but having user code running on the transceiver means you can power the big ol' CPU down and allow the transceiver to run autonomously, giving you longer battery life.

The language allows you to control the state machine of the transceiver, send/receive packets, do arithmetic operations, read/write memory, wait on hardware interrupts, control GPIO pins and the like. You can also put the transceiver to sleep, cause some code to run when a packet is received, all sorts of cool things.

e: I say this in the present tense, but... :v:

Spatial fucked around with this message at 21:47 on Jul 8, 2014

Soricidus
Oct 21, 2010
freedom-hating statist shill
That sounds really fun actually. Take it to the embedded programming thread, it doesn't belong here until you've hosed it up properly.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Do the VM and user code have to fit inside 768 bytes, or do you have more flash space for code and that budget is strictly your working RAM?

Either way you might find yourself inclined to apply Token threading and a simple stack VM to keep your code as dense as possible.

Mogomra
Nov 5, 2005

simply having a wonderful time
I'm tangled in this mess where I have to use PHP, some lovely MVC that my new boss rolled on his own, and a decently complex third party API to send (essentially) spam emails.

That's not even the horror, even though it is a horror.

The horror is that this third party requires that all the objects I create in their system have a unique name. It's not for security or anything, so it sounds like a job for uniqid(), right? Nope.

quote:

Warning
This function does not create random nor unpredictable strings.

If you call it more than once too quickly, it will return the same "unique id." :suicide:

One Eye Open
Sep 19, 2006
Am I awake?

Spatial posted:

At work I'm designing and implementing a language from scratch. Syntax, opcodes, virtual machine, compiler, everything is totally up to me.

The VM must fit in less than 768 bytes of memory.

I am become death, destroyer of minds :unsmigghh:

Base it on this(Minimal CPU that will fit in a CPLD) - only 4 opcodes to write for!

Adbot
ADBOT LOVES YOU

Westie
May 30, 2013



Baboon Simulator

Spatial posted:

At work I'm designing and implementing a language from scratch. Syntax, opcodes, virtual machine, compiler, everything is totally up to me.

The VM must fit in less than 768 bytes of memory.

I am become death, destroyer of minds :unsmigghh:

Brainfuck, please!

Mogomra posted:

I'm tangled in this mess where I have to use PHP, some lovely MVC that my new boss rolled on his own, and a decently complex third party API to send (essentially) spam emails.

That's not even the horror, even though it is a horror.

The horror is that this third party requires that all the objects I create in their system have a unique name. It's not for security or anything, so it sounds like a job for uniqid(), right? Nope.


If you call it more than once too quickly, it will return the same "unique id." :suicide:

It's not a GUID generator, that's for sure. It returns a hex representation of server time, which, after compiling it, pauses for a microsecond or some poo poo like that so each call within that box returns a different result.

For what you want it to be, it's unique enough. But since you're that obsessed, array_rand a salt from a list and hash it or something.

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