News for hackers. Stuff that matters.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by stefs on Monday June 25, 2018 @06:08PM (#17396251)
had to deal with ibm once. we were developing an application for a customer and ibm was working on some new service for them. of course the customer insisted we use the new ibm service, even though it solved a problem we didn't have at all. the ibm product was a website to be used by end users, while our application had to pass our end users data through. so, i asked the ibm guys (via the customer) to give me the docs for their json interface, as i don't necessarily want to parse HTML inside the application to exchange data. there was no json interface - html was all they had -, but they got to work implementing one.

what i got was:

    {"elem" : "html", "children": [ ... {"elem" : "form", "attrs" : {"action": "/an_url", "method" : "post"}, children: [{"input" : {"attrs" : {"type" : "submit", "value" : "..."}}}]} ..., ]}
yes, their json interface was the DOM, serialized as json. but it gets better. to submit my data i had to fill in the actual values in their json struct at the appropriate nodes and send it back.

i'm a) pretty sure this "json interface" feature cost the customer more than i make in a year, and b) it probably broke the very instant the customer let a frontend/designer guy change the html code months later.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ploxiln on Monday June 25, 2018 @07:50PM (#17396841)
Ah such classic outsourced third-world contractor output. They are told what to do (by some PM who has no idea) and they do it. If they ever say "uh this doesn't make sense" they are cheaply replaced. I've seen some of this nonsense (though not IBM related):

    strncpy(dst, src, strlen(src));
    dst[strlen(dst)] = '\0';
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by zeusk on Monday June 25, 2018 @09:34PM (#17397268)
> dst[strlen(dst)] = '\0';

That line alone is cancerous.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ggg9990 on Monday June 25, 2018 @10:57PM (#17397578)
Not a programmer. What’s so bad about it?
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by jonathankoren on Monday June 25, 2018 @11:06PM (#17397604)
It doesn’t make any sense.

The way a string is terminated in C is by a null character. ‘\0’ is a mnemonic. strlen() returns the length of a strong. It does this by doing a linear scan down the array until it finds the null, and the returns that index as the length.

That line of code does nothing useful. It means, “scan through the array until you find a null, then write a null there.” Which is exactly what you had to start.

So why would someone write this? Well, they were told to make sure that you always terminate your C strings with a null, otherwise you’ll run off the end of the array and corrupt memory. This is true, but this isn’t how you need to find the end of the array. They should have used the number from strlen(src), not strlen(dest). Even worse, strncpy() will put the null terminator in dest in this case.

The line belies any sense that the programmer had any understanding of what the code was actually doing. It’s a amateur mistake.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by zeusk on Tuesday June 26, 2018 @05:10AM (#17398985)
using strlen(src) is also an amateur mistake, because the whole point of doing that (stncpy family, ensuring dst ends with null) is that dst might not be large enough to fit string from src.

It has to be the size of dst, which can only be known at the site of allocation in C (except for a non-clean way of looking at heap metadata).

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by jonathankoren on Tuesday June 26, 2018 @12:17PM (#17401833)
There’s no reason to believe from these two lines that the memory is insufficiently allocated. It’s just two lines. The point wasn’t to share a safe string copy routine, the point of the post was to illustrate a single mistake.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by zeusk on Tuesday June 26, 2018 @12:24PM (#17401918)
I'm not assuming that, but then you can't assume the memory is sufficient either. If the string is from network or user, then you can never assume the buffer to be of sufficient size (which they definitely do, because they aren't tracking how much of src was copied into allocated dst).
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ploxiln on Tuesday June 26, 2018 @06:07PM (#17404354)
Each line, individually, is total nonsense.

It never makes sense to use strlen() for an argument to strncpy(). Only the size of the destination buffer makes sense for strncpy() (usually sizeof(dst)). For other cases you would probably use memcpy().

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by projectramo on Tuesday June 26, 2018 @08:45AM (#17400097)
pace @zeusk:

I thought the point was that they didn't know if the dest is long enough to copy source, so they copy as much of it as they can.

The reason for the '\0' is in the case that src is shorter than dest.

A more explicit way may be to strlen dest > src then just use lenght(src) otherwise use str(dest).

But this might actually be more efficient.

Edit: And in this case Spolsky doesn't apply because it seems the developer doesn't get to allocate the dest length.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by zeusk on Tuesday June 26, 2018 @12:23PM (#17401897)
Well...

If dst is larger than src, the strcpy* family of functions will also copy over the null byte.

If dst is shorter than src, and if strlen(src) is used as arg for strncpy then the function will overflow in dst and your null byte will also be outside dst buffer. In hardened environments you wouldn't trust strings to contain null byte if it comes from network or user and use strlcpy with known size of dst then append a null byte at end of dst anyway to ensure it is null terminated.

Using strlen to compare buffer sizes is totally wrong and is the source for many bugs (hint, strlen doesn't actually return size of anything but the distance of the first null byte from the address you provide it).

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ggg9990 on Monday June 25, 2018 @11:29PM (#17397664)
Thanks. Great explanation.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by nazri1 on Tuesday June 26, 2018 @07:13AM (#17399532)
See also: Shlemiel the painter [1]

[1] https://www.joelonsoftware.com/2001/12/11/back-to-basics/

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by copperx on Monday June 25, 2018 @10:26PM (#17397451)
That line belongs in a hall of shame somewhere in the internet.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by de_Selby on Tuesday June 26, 2018 @07:41AM (#17399685)
> by some PM who has no idea

This is the real problem. That PM of course wants the work done yesterday and has ego issues so even when the contractor does question it they just double down on what they originally said.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by forapurpose on Monday June 25, 2018 @11:59PM (#17397770)
> outsourced third-world contractor output

Do we know that the developers were outsourced or which countries they were from?

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ballenf on Tuesday June 26, 2018 @10:45AM (#17400956)
Yes, in an inferred way at least. Look at the IBM jobs / careers page and locations. You can see where different types of openings are. Last year I looked at the AI jobs because I was curious where they were doing the work. Mumbai was first in terms of open positions for machine learning, if I recall correctly.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by forapurpose on Tuesday June 26, 2018 @06:49PM (#17404586)
That tells us nothing about where the code discussed higher up this thread was written.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by snambi on Tuesday June 26, 2018 @12:26AM (#17397851)
Sounds like total failure of management
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by pythonistic on Monday June 25, 2018 @09:42PM (#17397300)
I'd tell you to get in touch with an Senior Architect but that's no guarantee that you'll get a good result. From my experience . . .

IBM sold a big outsourcing package to a major European insurance company: they would move ALL their stuff to the IBM Cloud (VMWare with a lot of custom BPM workflows to handle provisioning, etc.). None of this matched their other three big cloud projects, Bluemix, Softlayer, or their OpenStack project (Zenith -- my prior project), so it was all new from the ground up.

They needed to handle mass imports of DNS data from this insurance company (~1 million hosts) and other customers and they brought me in as a senior developer to do the grunt work. Since we were using ISC bind, I assumed we could use features like exporting zones with signed requests and take advantage of all the infrastructure work put into that server to scale up. Our Senior Architect poo-pooed that plan, so I started modeling the DNS records as structured data for consistent and complete import and export. Our senior architect also nixed that idea and said that we're gonna load the DNS structures with REST requests: the support people were gonna have a custom web application to load simple DNS export files (not zonefiles, mind you) into this system, and to make ad-hoc additions and changes. (When we had a new developer join, he had the same questions I had about why we weren't using all the DNS bind features since they were done and tested and perfect for our needs . . . it took a month to get him to stop asking.)

I got about 90% of the way through a solution with a Python Flask REST server at the center, high code coverage through unit tests (because it's Python and I was still finding edge cases that needed fixing to the very end), and Rabbit MQ for enqueuing the changes we've received before writing them out to DNS zone files. It works, but we certainly didn't need to blow April to August building out the architect's vision.

The reward I got was being pulled off the project when it was nearly code complete and would shortly go into production. I got a team based in India to manage in the mornings, while my afternoons and evenings were returned to developing Javascript for the BPM infrastructure jobs.

(When told I was going to leave for another company, IBM's counter-offer was to move me from my remote work-at-home location in Ohio, near family, to the Cloud Managed Services office in Rochester, MN, and then consider a raise.)

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by paganel on Monday June 25, 2018 @06:16PM (#17396297)
> yes, their json interface was the DOM, serialized as json.

This is pure thedailywtf material.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ryandrake on Monday June 25, 2018 @07:27PM (#17396697)
Did the change request come complete with specific requirements on what the interface should include? Because it sounds like they produced exactly what was asked for: a JSON interface. If the requirements were poorly specified, you can’t lay all the blame on them.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by gaius on Tuesday June 26, 2018 @02:13AM (#17398273)
Did the change request come complete with specific requirements

I get that you do need specs but c'mon, if you ask a plumber to fit a pipe from A to B and he uses one made out of cardboard would you think it was reasonable for him to say "well you didn't specify it had to carry water, pay me 3x as much to put it right". And then you find out that this is the first time he's even seen a pipe, but his business card says "senior plumbing expert".

You expect a basic level of competence and familiarity with the problem domain and good faith from any professional whose services you hire.

Also consider that a program is a spec, and if you are going to explicitly specify every little detail then you might as well just write the program yourself, there is literally no sane reason to put an outsourcer in the middle.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by blihp on Tuesday June 26, 2018 @04:50PM (#17403875)
Unfortunately, that's not how the game works with the large services firms. The salespeople and account/project managers run the show. Their business isn't selling expertise / solutions, it's selling the maximum amount of billable hours at the highest possible margin via the illusion of expertise / solutions. (I say illusion because if you read the fine print of one of their typical contracts, there's very little actually promised other than providing warm body of type X for hourly rate of Y)
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by Macuyiko on Tuesday June 26, 2018 @03:29AM (#17398571)
Exactly, this is everything that I hate about requirements management and requirements-driven-development in a nutshell. Way too often it just means: "we're actually too lazy / overworked / uninterested / have targets that don't align with the long-term best outcome, so we'll just force you to write down requirements which we know can't and won't ever be complete." It's the best way to cause internal politics to fire up and projects to belly up.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by manigandham on Monday June 25, 2018 @08:36PM (#17397064)
Yes you can. There's a basic level of competence in dealing with context around a request. Any decent developer or PM would know what a JSON API is supposed to be.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by therealtomsmith on Monday June 25, 2018 @07:41PM (#17396786)
The act of them doing that alone shows that they either dont get it or that complexity within the organization has brought productivity to a hault. I'd assume it's the second one.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by HelloNurse on Tuesday June 26, 2018 @04:43AM (#17398847)
The interface should include engineering.

A responsible developer is expected to ask insistently until the requirements make sense; whoever delivered the JSON DOM is stealing their pay, even if they did it knowingly as a joke or provocation.

Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by piva00 on Tuesday June 26, 2018 @03:40AM (#17398606)
You are talking to humans, not programming a machine, you don't have to instruct them on each minimal detailed step to specify something, you expect agency, even more if you are paying big bucks.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by erikpukinskis on Monday June 25, 2018 @07:34PM (#17396735)
Turns out the interface was built by Watson and technically met the spec.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by bhouston on Tuesday June 26, 2018 @08:54AM (#17400151)
It is because ibm employs ultra cheap devs in India who barely know what they are doing. Ibm made itself into a low cost low quality Indian outsourcing firm but they charge high prices. Worst of all worlds.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by raverbashing on Tuesday June 26, 2018 @12:57AM (#17397954)
And that's why IBM still makes billions of dollars, because we have fools like your client.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by adventured on Tuesday June 26, 2018 @01:33AM (#17398119)
Here's how large the remaining inertia of IBM is: they're operating at a level where they can still generate $9-$10 billion per year in net income. That's about 2.5 times more than the most profitable tech company in all of Europe (SAP).
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by scoggs on Tuesday June 26, 2018 @12:11AM (#17397802)
MY GOD that is painful to take in. I feel for you :( . I've shed a tear for a fellow programmer in the thick of the "shit".