by Remy Porter on (#2KQ2P)
Tony Hoare has called null references his “billion dollar mistakeâ€. Dealing with nulls and their consequences have created a large number of bugs, and eaten a lot of developer time. It’s certainly bad enough when you understand nulls and why they exist, but Benjamin Soddy inherited code from someone who absolutely didn’t.First, there’s our new type, the ByteBool:
|
The Daily WTF
Link | http://thedailywtf.com/ |
Feed | http://syndication.thedailywtf.com/TheDailyWtf |
Updated | 2024-11-23 01:46 |
by Remy Porter on (#2KJVM)
In the Before Times, the Ancients would gather in well-sheltered caverns, gather to themselves foods blessed by the gods, drink strange, unnaturally colored concoctions, and perform the Rite of the LAN Party.In the era when the Internet was accessed by modem, to have any hope of playing a game with usable latency, you had to get all the players in the same place. This meant packing up your desktop in a car, driving to your friend’s house, and setting up your computer on whatever horizontal surface hadn’t already been claimed by another guest.
by Ellis Morning on (#2KETK)
|
by Jane Bailey on (#2KBBN)
Monday morning, 10:00AM. As per usual, today's protagonist, Merv, got some coffee and settled in for his usual Monday morning routine of checking Facebook and trying to drag his brain into some semblance of gear. As he waited, the least interesting conversation ever floated to his ears from the hallway:"It's like, yak butter, I guess? I put it in my coffee, it's supposed to do wonders."
|
by Mark Bowytz on (#2K2T4)
"Since clicking 'Yes, I mind', took me to the review page, I left a one star review," writes Pascal.
|
by snoofle on (#2JZ96)
We've all been approached for jobs where the job description was merely an endless list of buzzwords across disciplines, and there was no real way to figure out what was actually the top couple of relevant skills. The head hunter is usually of no help as they're rarely tech-savvy enough to understand what the buzzwords mean. The phone screen is often misleading as they always say that one or two skills are the important ones, and then reject candidates because they don't have expertise in some ancillary skill.Teddy applied for a position at a firm that started out as a telco but morphed into a business service provider. The job was advertised as looking for people with at least 15-20 years of experience in designing complex systems, and Java programming. The phone screen confirmed the advert and claims of the head hunter. "This is a really great opportunity," the head hunter proclaimed.Then it was time for the interview. The interview was the sort where you meet with the manager, a peer of the manager, and several senior members of the team, repeating your work history for each one.There was a coding exercise to see if you could convert an int to a Roman numeral and vice versa.Each person asked some simplistic architectural design type questions...
|
by Remy Porter on (#2JVAW)
Cédric runs the backend for a video streaming service. Since video streaming, even in modern HTML5, is still a bit of a mess, they have to be able to provide many different stream formats. So, for example, the JSON data might look like this:
|
by Ellis Morning on (#2JQGC)
In the mid-90s, Darren landed his first corporate job at a company that sold IT systems to insurance brokers. Their software ran on servers about the size of small chest freezers—outdated by the 70s, let alone the 90s. Every month, they'd push out software fixes by sending each customer between 3 and 15 numbered floppy disks. The customers would have to insert the first disk, type UPDATE into the console, and wait for "Insert Disk Number X" prompts to appear on screen.It wasn't slick, but it worked. The firm even offered a recycling service for the hundreds of disks that eventually built up at customer sites.While working there, Darren became unfortunately well acquainted with one particular insurance broker, Mr. Lasco. The man refused all offers of training ("Too expensive!") and paid support ("You don't know enough!"), and was too good to read instructions, but could always be counted on to tie up some poor tech support rep's phone every time a new update went out. He never let them charge the call against his company's account, or even thanked anybody for the help. When told about it, management just shrugged their shoulders. Mr. Lasco's firm did have a big contract with them, after all.Early one Monday morning, Darren answered his phone, only to receive an ear-splitting tirade. As Mr. Lasco ranted, Darren held in a sigh and used the time to start filing a support ticket."What's the nature of your problem, sir?" he asked during the gap in which Mr. Lasco paused to breathe."I—it's—your damn update won't work! Again!" Mr. Lasco sputtered. "My machine is full!"Darren frowned. That wasn't an error message that the update process would ever throw. "'Full?' Hmm, maybe one of the server's hard drives is out of disk space? Maybe you need to—""No, you fool, it's full! It's FULL!" Mr. Lasco snapped. "I KNEW this would happen eventually! Do you know how much money I'm losing right now with this thing down? I want one of your people to come out here and fix this immediately!"The demand prompted an eyeroll from Darren, who already knew Mr. Lasco would never pay for a consultant's time. Still, this was a perfect way to get him off the phone. "Why don't I forward you to your sales rep?"To Darren's amazement—and pity—a software engineer was dispatched within the hour to drive several hundred miles to Mr. Lasco's site, with instructions to call Darren with updates.By late afternoon, the call came. The engineer was laughing so hard, he couldn't talk."Is everything OK?" prompted Darren."Wait'll you hear this." The engineer struggled to breathe. "There's a gap in the server casing. All this time, Lasco's been inserting update disks into the server, and couldn't force any more in. I popped the case open, and swear to God, there must be a few hundred disks crammed in there, easy. Years of updates!"Darren joined in the mirth, but it was short-lived. The poor engineer had to spend 7 hours onsite carefully extracting floppy disks wedged between drives and memory cards, sorting them, then applying the updates in order.The one silver lining to the whole affair was that Mr. Lasco never called them again.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
|
by Remy Porter on (#2JKYD)
In the Star Trek episode, “A Piece of the Actionâ€, Kirk and his crew travel to Sigma Iotia II, a planet last visited before the Prime Directive of non-interference existed. Well, they left behind a book, Chicago Mobs of the Twenties, which the Iotians took as a holy guide, to be imitated and followed even if they didn’t quite understand it, a sort of sci-fi cargo-cult. Cue the crew of the Enterprise being threatened with Tommy Guns and guys doing bad Al Capone impressions.Michael’s co-worker may have fallen into a similar trap. An advanced developer came to him, and gave him a rule: in PHP, since variables may be used without being declared, it’s entirely possible to have an unset variable. Thus, it’s a good practice to check and see if the variable is set before you use it. Normally, we use this to check if, for example, the submitted form contains certain fields.Like Bela Okmyx, the “Boss†of Sigma Iotia II, this developer may have read the rules, but they certainly didn’t understand them.
|
by Mark Bowytz on (#2JDA1)
"I too have always felt that discount codes are a great way to express sympathy," writes Shawn A.
|
by Remy Porter on (#2JAFG)
Microsoft’s C# has become an extremely popular language for “enterprise†development, and it’s sobering to think that: yes, this language has been around for 15 years at this point. That’s long enough for the language to have grown from a “sort of Java with reliability, productivity and security deleted.†(James Gosling, one of the creators of Java) to “sort of Java, but with generics and lambdas actually implemented in a useful way, and not completely broken by designâ€.15 years is also more than enough time for a project to grow out of control, turning into a sprawling mass of tentacles with mouths on the ends, thrashing about looking for a programmer’s brain to absorb. Viginia N is currently locked in a struggle for sanity against one such project.Some of the code looks like this:
|
by snoofle on (#2J7KD)
A long, long time ago when C was all the rage and C++ was just coming into its own, many people that were running applications on Unix boxes used the X-Windowing system created by MIT to build their GUI applications. This was the GUI equivalent of programming in assembly; it worked, but was cumbersome and hard to do. Shortly thereafter, the Xt-Intrinsics library was created as a wrapper, which provided higher level entities that were easier to work with. Shortly after that, several higher level toolkits that were even easier to use were created. Among these was Motif, created by DEC, HP, etc.While these higher level libraries were easier to use than raw X-lib, they were not without their problems.Sam was a senior developer at Military Widgets, Inc. His responsibilities included the usual architectural/development duties on his project. One day, Pat, Sam's boss, asked him to stay late. "Taylor has a bug that he just can't crack," Pat explained. "I want someone with a little more experience to give him a hand."It seems that after making some changes to their Motif GUI, the application started throwing stack dumps on every transaction. As a result, every transaction was rolling back as failed. Taylor insisted that his code was correct and that it was not the cause of the problem. To this end, Pat asked Sam to stay late one afternoon and take a look at it.After some company-sponsored pizza, Pat had Taylor hand Sam a stack trace. In the middle of it was a call to:
|
by Remy Porter on (#2J3QQ)
There’s plenty of bad code that makes you ask, “what were they thinking?†There’s a whole bunch of code we get, however, that doesn’t even raise that question- the programmer responsible simply wasn’t thinking. Today, let’s examine a few “programmer brain-fartsâ€. We turn our attention first, to Jim C.While reviewing some unit tests, he found this line:
|
by Lorne Kates on (#2J06S)
Radio WTF Presents!Jump to transcriptWelcome back to Radio WTF. This week, we visit a two kilometer wide mushroom in space, and find out WTF happens when unexpected guests arrive...Soundcloud Links:Radio WTF: Space for GuestsDirect Download:SpaceForGuests.mp3Starring (in order of appearance)Jane Bailey... as Commander Josephine Garneau
by Mark Bowytz on (#2HPQC)
"I have a feeling that VS Code is trying to tell me that the object class provides functionality common to all JavaScript objects," writes Eric.
by Jane Bailey on (#2HJWA)
Hikari had just left Apps R' Us when our submitter, Steve, was asked by the CEO to review some of his code. Now, Steve wasn't on the same project as Hikari, but he had a reputation for being thorough and concise, while Hikari had a reputation for being fast but sloppy. Apps R' Us was a smallish shop, so Steve was a good pick for taking over the project despite barely knowing the requirements.Hikari was working on an augmented reality game for a very specific problem domain. In this use case, GPS was going to be unreliable. Instead, they needed to focus on the compass heading and rough location most times, at most correcting a little from GPS data. Steve skimmed through the code, looking for the overall structure before he dove into the fine details, but the following comment stopped him in his tracks:
by Remy Porter on (#2HETF)
Usul is taking a college course on Java programming, and it’s doing an excellent job preparing him for the real world. Already, he’s been forced to cope with someone who knows one true fact and has run off to apply it in the dumbest way possible. This would be his professor.Our true fact is this: A Java PreparedStament object, used for running database queries, should be closed after use. This returns its connection to the pool and frees any resources the statement was using. You should do this, and you should do it as soon as you’re done with your connection.Now, putting a call to stmt.close() in every finally block was just too much for Professor McCloseypants to deal with. So he provided this “convenience†object to deal with that problem.It’s a lot of code, so we’re going to do this in pieces. First, let’s look at the declaration:
by TJ Mott on (#2HAS3)
David was recently hired on to head the company’s development team. This was a brand-new position; previously, William, the company’s IT Manager managed the developers directly in addition to his other duties.While getting his workstation set up, he was unable to install the FileZilla FTP client. It was completely blocked via domain policy. Finding this very strange, David talked to the IT Manager and hoped there was a legitimate reason.“FTP is a big security risk,†William explained. “We got hacked through FTP once so I firewalled it by blocking FileZilla installation with Group Policy.†David began to suspect that things at the company were not quite right.“Um, Group Policy isn’t a firewall,†David tried to explain. “And blocking an FTP client installer is unlikely to have an effect on network security.â€William clearly didn’t understand and doubled down on his incorrect ideas. “Trust me, it works,†he said. David soon gave up and simply installed a different FTP client–which worked just fine despite FTP being “firewalled.â€Later, while familiarizing himself with the business’s core applications, David decided to examine the company’s main database server. “It’s set up with RAID 10 for the best performance,†William explained. RAID 10, sometimes called RAID 1+0, mirrors all data into two arrays for fault tolerance, and then each array is striped onto additional disks to greatly improve read/write performance. It’s one of the fastest RAID configurations and a great fit for database servers.But David ran a disk benchmark and was not convinced. “That disk I/O is way too low for RAID 10,†he explained. “Can you show me the configuration?â€â€œOf course,†William replied. “It has to be RAID 10. We ordered it that way.â€They opened the RAID manager for the system, and sure enough the system was not running RAID 10. “Um, this is RAID 5,†David explained. RAID 5 uses three or more disks for striping, but the capacity of one disk is lost for storing parity data which allows the array’s data to survive a single-disk failure. Due to the required parity calculations, RAID 5 writes are not nearly as fast as RAID 10, which is bad for an I/O bound application such as the company’s main database server.“That can’t be,†William responded. “Oh, I know…Kieran must have changed it!†He called the company’s so-called systems administrator to the room, and David endured the uncomfortable exchange as William hurled wild accusations. “I know we ordered this system with RAID 10! Why did you change it?â€â€œI just unboxed it and racked it,†Kieran responded. “Whatever RAID level it has is what it was shipped with.â€â€œThat can’t be true! You tampered with it!â€Kieran rolled his eyes and turned to leave. “I have real work to do elsewhere,†he rudely explained as he excused himself from the conversation. Later on, he sent an email to both David and William which contained the original Purchase Order for the server. The PO clearly showed that William had specifically requested RAID 5 for the server.David found himself wondering if management was aware of William’s behavior and general incompetence, but tried to avoid making waves during training. But the final straw came when he set about installing several of the company’s internal applications and was unable to find any installers on his own. Once again he went to talk to William.“Oh, we don’t install any of our applications. That’s too slow!†he explained. “Instead, look at the database server. It has a shared folder called ‘APPS’, and just map that as a network drive and run everything from there.â€Once again, David found himself doubting the IT Manager’s wisdom. “Doesn’t it hurt our database performance to have the entire company mapping a network drive to the same RAID array as the databases?†he asked.“Oh no,†he replied. “It actually makes it faster. The apps can talk to the database much faster if they’re running from the same server!â€David was stunned by William’s poor understanding of how network-mapped file systems actually work. “That might be true if it was a terminal server…but the applications still run locally on the end user PCs. The files just happen to be stored elsewhere.â€â€œWhat do you know, you’re still the new guy! We’ve had this procedure in place for years now, and for good reason!â€Despite being a newbie, David decided to approach management about the ineptness he’d discovered, and explained that William was rude, incompetent, and had no business working in IT. To his surprise, management conducted a brief investigation and agreed with him! Shortly afterwards, William was let go.The new IT manager was shocked at the company’s infrastructure and quickly made a range of improvements. This included installing a proper Storage Area Network which greatly improved the database server’s performance; a new storage pool for mapped drives which was on separate disks than databases; and a real hardware firewall which, among other things, actually blocked incoming FTP connections from the Internet.David then forwarded his story on to us at The Daily WTF as a reminder that sometimes things actually do turn out okay in the vast WTF-land that is the IT industry. [Advertisement] Easily create complex server configurations and orchestrations using both the intuitive, drag-and-drop editor and the text/script editor. Find out more and download today!
by Remy Porter on (#2H6Y3)
I have certain mantras that I use to guide my programming. They generally revolve around this theme: "Thinking is hard, and I'm not very good at it; every block of code should be simple and obvious, because if it makes me think, I'll probably screw it up and break something." It's a good rule for me, and a good general guideline, but it's a little vague to implement as a policy.Erika’s company wanted to implement this idea as a policy, so they set a limit on how many lines could be in a single method. The thinking was that if each method was short- say, under 100 lines- it would automatically be simple(r), right?Well, Garret, down the hall, wrote a method that was three hundred lines long. During a code review, he was told to refactor it to simplify the logic and comply with the policy. So he did.
by Mark Bowytz on (#2GXKN)
"Wow! Those folks from null and undefined must be big fans! I mean, just look at that voting turnout!" Kayleigh wrote.
by snoofle on (#2GSVT)
Alan worked for Maria in the Books-and-Records department of a massive conglomerate. Her team was responsible for keeping all the historical customer transaction records on line and accessible for auditors and regulatory inquiries. There was a ginormous quantity of records of varying sizes in countless tables, going back decades.Maria was constantly bombarded with performance issues caused by auditors issuing queries without PK fields, or even where-clauses. Naturally, these would bring the servers to their proverbial knees and essentially prevent anyone else from doing any work.To solve this problem, Maria decided that all auditors and regulators would be locked out of the database for purposes of direct queries. Instead, they would be provided with an API that would allow them to mimic a where-clause. The underlying code would check to see if no PKs were specified, or if a where clause was missing altogether. If so, it would run the query at a much lower priority and the auditor issuing the offending query would wait while the servers did the massive scans in the background, so the other auditors could continue working with a reasonably responsive database.So far, so good.Alan wanted to build a mechanism to query the list of available tables, and the columns available in each. This could be provided via the API, which the auditors' developers could then programmatically use to create the objectified where-clause to submit as part of a query.Maria would have nothing to do with that. Instead, she wanted to sit with each potential auditor and have them define every single query that they could possibly ever need (table(s), column(s), join(s), etc). Alan pointed out that the auditors could not possibly know this in advance until some issue arose and they had to find the data relevant to the issue. Since this would vary by issue, the queries would be different every time. As such, there was no way to hard-wire them into the API.She put her foot down and demanded a specific list of queries since that was the only way to build an API.Alan went to every auditor and asked for a list of all the queries they had issued in the past year. They grudgingly obliged.Maria then went on to design each API function call with specific arguments required to execute the given underlying query. The results would then be returned in a dedicated POJO.Again, Alan groaned that defining a POJO for each and every subset of columns was inappropriate; they should at least design the POJOs to handle the entire column set of the given table, and have getters that represented columns that were not requested as part of a given API query throw a column-not-queried exception. Maria said No and insisted on separate POJOs for each query.Some time later, Alan had finished building the API. Once it was tested and deployed, the other development teams built relevant GUIs to use it and allow the auditors to pick the desired query and appropriate parameters to pass to it.This worked well until an auditor needed to add a column to one of the queries. If Maria had let Alan use table-wide column pick-lists and POJOs that had all the fields of a table, this would have been easy. However, she didn't, and made him create another virtually identical API function, but with a parameter for the additional column.Then it happened with another query. And another. And another.After a while, there were so many versions of the API that the managers of the other teams blasted her choice of implementation (they had to deal with the different versions of the POJOs for each table in their code too) and demanded that it be made sane.Finally, under pressure from above, Maria relented and instructed Alan to change the API to use the pick lists and POJOs he had originally wanted to provide.To implement this required changing the signature of every method in the API. Fearing a riot from his counterparts, he got them all together and offered a two month window during which both old and new versions of the method calls would be supported. This would give their teams a chance to make the code changes without forcing them to drop their current priorities. The other developers and managers quickly agreed to the dual-mode window and thanked Alan.Then a few of the other managers made the mistake of thanking Maria for the window in which to make changes.She royally reamed Alan: "Did I tell you to give them a dual-mode window? Did I? You will immediately pull the old methods from the API and re-deploy. You will NOT email the other teams about this. Get it done; NOW!"Alan had worked very hard to develop a good working relationship with his peers and their respective managers. Now he had been ordered to do something that was downright nasty and would absolutely destroy said relationships.Alan changed the API, ran the tests, and entered the command to deploy it, but did not hit ENTER.Then he quietly went around to each of the other managers, told them what he had been instructed to do and apologized for what was about to happen. He was somewhat taken aback when every single one of them told him not to worry; they had dealt with Maria before, that they appreciated his well-intentioned but ill-fated attempt to be a team player, and that they completely understood.After that, he went back to his desk, hit ENTER, and contemplated asking the other managers if they could use a good developer.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
by Remy Porter on (#2GP1D)
Ah, the grand old Dictionary/Map structure. It’s so useful, languages like Python secretly implement most of their objects using it, and JavaScript objects imitate it. One of its powers is that it allows you to create a sparse array, indexed by any data type you want to index it by.Catherine’s cow-orker certainly thought this was pretty great, so they went ahead on and used the Dictionary to map interest rates to years. Years, for this application, were not tracked as actual years, but relative to an agreed upon “year zeroâ€- the first year of the company’s operation. There was a new annual interest rate tracked for each year since.If you’re saying to yourself, “wait… this sounds like a use case for arrays…â€, you’re onto something. Pity you didn’t work with Catherine. You probably wouldn’t have left this behind:
by Jane Bailey on (#2GJK7)
Dima had just finished her Masters in electrical engineering, and was eagerly seeking out a job. She didn't feel any particular need to stick close to her alma mater, so she'd been applying to jobs all over the country.When the phone rang during lunch hour, she was excited to learn it was a recruiter. After confirming he had the right person on the phone, he got right down to business: "We saw your resume this morning, and we're very impressed. We'd like you to come out for an on-site interview and tour. What's your availability next week?"Dima agreed. It was only after she hung up that she realized he'd never given his name or company. Thankfully, he sent her an email within ten minutes with the information. It seemed he was representing DefCo, a major defense contractor with the US government. This would normally be worth a look; it was particularly interesting, however, because she'd only submitted her resume about an hour and a half prior.They must be really impressed, she thought as she replied to confirm the travel arrangements. It'll be nice working someplace large that doesn't take forever to get things done.A week later, Dima hopped out of the cab and made her way into the building. Wrinkle number one immediately presented itself: there were at least twenty other people standing around looking nervous and holding resumes.I guess they interview in groups? she wondered. Well, they're clearly efficient.As Dima waited to tour her first top-secret manufacturing plant, she made small talk with some of the other candidates, and hit wrinkle number two: they weren't all here for the same job. Several were business majors, others had only a high school diploma, while others were mathematicians and liberal arts majors.Clearly they're consolidating the tour. Then we'll split up for interviews ...?The tour guide, a reedy man with a nervous demeanor and a soft, timid voice, informed them that interviews would be conducted later in the day, after the tour. He walked them down the hallway.Dima kept close to near the front so she could hear what he was saying. She needn't have bothered. As they passed the first closed door, he gestured to it and stammered out, "This might be a lab, I think? It could be one of the engineering labs, or perhaps one of the test facilities. They might even be writing software behind there. It's bound to be something exciting."This went on for the better part of two hours. They passed locked door after locked door, with their guide only speculating on what might be inside as he fidgeted with his glasses and avoided eye contact. Finally, he declared, "And now, we'll tour the test facilities. Right this way to the warehouse, please. You're going to love this."Wait, he didn't hedge his bets? We might actuallyseesomething today?! Dima knew better than to get her hopes up, but she couldn't help it. It wasn't as though they could get any lower.They were let into the warehouse, and their guide took them straight toward one particular corner. As they crowded around what appeared to be an ordinary truck, their guide explained its significance in hushed, breath-taken tones: "This is the system upon which our new top-secret mobile Smart-SAM and cross-pulsed radar will be mounted. Soon, this will be one of the most advanced mobile platforms in the United States!"And soon, it will be exciting, thought Dima in dismay. Right now, it's a truck."This concludes our tour," announced the guide, and it was all Dima could do not to groan. At least the interview is next. That can't be nearly as much of a let-down as the tour.Dima was shown to a waiting area with the mathematician, while the others were spilt into their own separate areas. She was called back for her interview moments later. At least they're still punctual?The interviewer introduced himself, and they shook hands. "Have you ever worked on a power supply, Dima?" he asked, which seemed like a logical question to begin the interview. She was just about to answer when he continued, "Just last week I was working on the supply for our cross-pulsed radar. That thing is huge, you wouldn't even believe it. Of course, it's not the biggest one I've ever built. Let's see now, that would've been back in '84 ..."To her horror, he continued in this vein for fifteen minutes, discussing all the large power supplies he'd worked on. For the last five minutes of the interview he changed topics, discussing sound amplifiers you could run off those power supplies, and then which bands would make best use of them (Aerosmith? Metallica? Dima didn't care. She just kept nodding, no longer bothering to even smile). Finally, he thanked her for her time, and sent her on her way.The next day, Dima was informed that she hadn't obtained the position. She breathed a sigh of relief and went on with her search.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
by Remy Porter on (#2GEKN)
Dan has inherited a pile of Objective-C. That’s not the WTF. The previous developer had some… creative problem solving techniques.For example, he needed to show a splash screen, and after three seconds, make it vanish. You might be thinking to yourself, “So I set a timer for 3000 milliseconds, and then close the splash screen, right?â€
by Mark Bowytz on (#2G5FA)
"With fraud protection like this, I feel very safe using my card everywhere," Brad W. writes.
by Remy Porter on (#2G1VW)
Thanks to a combination of illnesses, travel, timezones, and the other horrors of the modern world, we took a week off. If Angular can skip version 3, we can skip episode 3. Welcome to Episode 4 of Software on the Rocks, brought to you by Atalasoft.In today’s episode, we are joined by TDWTF author Jane Bailey. We talk about the process of writing, the nature of programming, and “programmer anarchyâ€.This episode of Software on the Rocks is brought to you by Atalasoft.MP3Web Player
by Ellis Morning on (#2FY3W)
Sacha received custody of a legacy Python API, and was tasked with implementing a fresh version of it.He focused on authentication first. The existing API used JSON web tokens that, for some reason, never expired. Assignments like expiration=86400 and expiration=3600 were littered throughout the code, but seemed to go ignored.It didn't take long to track down the token generating code and figure out the tokens' source of (near) immortality:
by Charles Robinson on (#2FVMQ)
The 80's were a time of great technological marvels. The Walkman allowed a person to listen to music anywhere they went. The Video Cassette Recorder allowed you to watch your favorite movies repeatedly until they wore out. Then there was the magic of Fiber Optics. Advances in the light-blasted-through-glass medium allowed places like Seymour's company to share data between offices at blistering speeds.Bill, the President of Seymour's company, always wanted them to be on the cutting edge of technology. He didn't always know the why or the how surrounding it, but when he heard about something that sounded cool, he wanted to be the first company to have it. That's where Seymour came in. As Vice President of Technological Development (a fancy job title he got for being the organization's only true techie) he made Bill's dreams come true. All he had to do was ask for the company credit card.When Bill caught wind of fiber optics at a trade show, he came back to the office ranting and raving about it. "Seymour, we've got to link the offices up with these fiber optical things!" he shouted with enthusiasm. Since their buildings were a mere three miles apart it seemed like overkill, but Seymour was bored and needed a new project. "I've had it with these slow noisy modem things we use to exchange data! I want you to weave these fibers into our computers. You can start today!"Seymour had to calm Bill down and explain to him what a big ordeal getting set up on fiber would be. Since there weren't any existing lines in town, one would have to be routed underground on the route between offices. Seymour got in contact with local utility and telecommunications companies and the initiative was underway.Fast-forwarding eight months, Seymour's fiber connection was a success. The cranky old modems had been mothballed and were a distant memory. Files and reports were being sent between offices at literal light-speed. Bill made it worth all the trouble with a sizable deposit into Seymour's bank account and his own company credit card. But then one day things went awry.Seymour's phone rang at 6:30 one morning. Bill, always the early arriver, was on the other end in a panic. "Seymour! You need to get here right now! The fibers are cooked and we can't download anything to the other office!" Seymour quickly threw on some clothes and got in his car. His commute took longer than normal because of some irritating utility work slowing down traffic but he was sure he'd have it solved in no time.Upon arrival, he took out his trusty fiber testing kit and hooked it up to one of the pairs. Nothing. He tried the next pair. Nothing. The other 13 pairs yielded the same result. "What in the hell?" he thought to himself, with Bill hovering over his shoulder. Further inspections showed nothing was wrong with their equipment in the building."Seymour, this isn't acceptable!" Bill bellowed to him, growing sweatier by the minute. "First it takes you forever to get here, now you don't have any answers for me!""I'm sorry, Bill. I got here as soon as I could. There was this damned utility work in the way..." Seymour cut himself off as an illuminated fiber light went off in his head. "I'll be right back!" Seymour ran out to his car to drive back the way he came. The route he took to work also happened to share some of the fiber line's route.He stopped at the dig site to find it mostly cleaned up with one construction worker remaining. Inspecting the ground, he found the utility company had done their work spray painting the correct areas not to dig. Green here, for the sewer, yellow for natural gas gas over there, and a communications line there. A new utility pole stood proudly, far away from any of the marked areas.Well, it was a good thought, anyway. Seymour ducked under the pole's anchor cable and started back to his car- then stopped. He looked at the anchor cable, and tracked its end down into the orange spray-paint that marked a communication line. He bent down for a closer look and found shredded bits of fiber optic cable. Bingo. He flagged down the last remaining worker to point it out, "Excuse me, sir. I think there's been an accident. This line here was essential to my company's computer system."The portly man in a hard had sauntered over, unconcerned. "Wut? This here thing? Ain't nothin but a bundle of fishing line some'un went an buried fer some reason. This ain't no computer.""Oh, right... My mistake," Seymour offered a token apology and decided he wasn't going to get through to this particular city worker. He drove back to the office and filled Bill in on the mishap. Bill's anger was quickly channeled into an unfriendly phone call to city hall and within 24 hours Seymour's incredible fiber line was back in service. After all the effort the past several months, a getaway to use actual fishing line for its intended purpose sounded like something Seymour badly needed.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
by Remy Porter on (#2FVMR)
A few months ago, Hannes shared with us some recycled code. In that installment, we learned that one of his team mates has… issues with strings. And naming things. And basic language features.These issues continue.For example, imagine if you well that you have a file. This file contains certain characters which you want to remove. Some need to be converted into other forms, like the letter “G†should become “6â€, and “B†should become “8â€. Think through how you might solve this.
by Mark Bowytz on (#2FDEV)
"Microsoft has really stepped up their remote publishing game with their Visual Studio 2017 RC!" writes Robert M.
by Remy Porter on (#2F9BM)
John N supports a C# project that, on first run, needs to initialize a database. It pulls that data from a dbInstallFilePath, controlled by the application .config file. This brings us to our representative line:
by Remy Porter on (#2F583)
John C was a vigilant protector of justice, a dark guardian of a public who didn’t even know he existed, striking fear into the hearts of criminals. Specifically, he did IT support for the local police department. It wasn’t a great job. Their infrastructure was ancient, underfunded, and under-supported. He was expected to provide just as much support for the department’s website as well as their radio system. The customers were a “special†brand of ignorant, and often pretty angry about it. The department provided service 24/7, which meant John was expected to be available at weird hours, and not even for emergencies. Many of his customers only worked night shifts, and he had to support them.At around 3AM, John caught a ticket, entered in by one of the secretarial staff. “Officer Bishop reports her email is brokeâ€. With that cornucopia of information, he called Officer Bishop.“I had a high school student participate in a ride-along,†she said. “He wanted some pictures of what our shooting range looked like for a presentation, so I tried to email them. I emailed them to ‘napoleon dot wilson at hot mail dot com,’ but I got an error message about it was undeliverable.â€â€œWell,†John said, “are you sure the email address is accurate?â€â€œYes!†Bishop said. “It was his first name, dot last name, at hot mail dot com.â€â€œAnd it’s spelled correctly?â€â€œYes!†Bishop said, becoming increasingly indignant. “n-a-p-o-l-e-o-n-dot-w-i-l-s-o-n-at-h-o-t-m-a-l-e.comâ€John chuckled. “I don’t think that’s quite right. I think it’s hotmail, as in postal mail. Like a letter. M-a-i-l.â€â€œI know what email address he gave me,†Bishop said. “He said ‘hotmale’. I know what he said.â€John took a breath and tried a different tack. “The words ‘male’ as in a man and ‘mail’ as in letters sound the same. If he just said his email address aloud, you might have simply heard him wrong.â€â€œI know what he said,†Bishop said. “Do you think I’m stupid? I know what words mean. He told me his address was hot male!â€â€œOfficer, I’m not saying you’re stupid,†John said, summoning every ounce of self-control that he could. “But hotmail, like the letter, is a popular email service. Hotmale, like the restroom, is… um… something very different.â€â€œLook, I know you IT people think you’re soooooo smart, but stop treating me like an idiot. I’ve been a police officer for longer than you’ve been wearing diapers. I know what he said.â€â€œMa’am, can I just get you to try sending an email to napoleon.wilson@hotmail.com, like the letter? Just try it for me?â€â€œHe said hotmale.â€Fine, John thought to himself. It was 3AM, and Officer Bishop was on his last nerve. “Ma’am, let’s try something here. I want you to open hotmale.com in your web browser.†He was the IT person- and thus he knew that there was a lot of porn-browsing on station computers, what was a little more, right?“That’s the little blue E, right?â€â€œYes.â€After a beat, he heard, “ACK!â€John waited a beat, hoping to hear Officer Bishop could finally turn her powerful investigative mind to understand what he had been trying to tell her. Her “ack†segued into a gasp of understanding. John started nodding to himself, happy that Bishop had finally figured it out, now that a gay pornography site was staring her in the face.“Oh, I didn’t know… he’s gay?! He didn’t look gay.â€â€œNo, he’s not- I mean, he might be, but-â€Bishop wasn’t listening to him at all. “Oh, but I guess you can never tell these days…â€â€œNo, try and go to hotmail, like the letter now…â€â€œHey, there’s a link to contact them at the bottom of the site. Maybe we should tell them that their email is broken.â€John looked at the clock- it was 3:15 at this point, but it felt like he’d been working on this ticket for hours. “Okay, actually, so it sounds like the problem must be on their end. Why don’t you do this: start a new email, and send it to admin@hotmale.com. Tell them that you were trying to get in contact with Napoleon Wilson, and include the error message that you were getting, along with the message you were trying to send to Napoleon.â€â€œOkay, I’ll do that, but let me give you a piece of advice- don’t talk to people like they’re stupid.â€â€œI’ll definitely keep that in mind,†John said. “I’m just going to go ahead and close this ticket.†[Advertisement] Universal Package Manager – store all your Maven, NuGet, Chocolatey, npm, Bower, TFS, TeamCity, Jenkins packages in one central location. Learn more today!
by Remy Porter on (#2F13G)
Let’s say you needed to initialize a buffer to be 260 bytes long, and they all should be 255. Now, you’re using a high-level language, like C#, to talk to a legacy device, so you might have to jump through some hoops to deal with the device API, but how hard could it be? A better question might be, “how hard can you make it?â€There’s an old saying: “fast, good, or cheap: pick twoâ€. Massimo’s employer doesn’t want to be greedy, so they consistently pick one: cheap, which means they get code like this:
by Ellis Morning on (#2EX8V)
Fresh off an internship, Trace landed his first full-time job performing customer service and administration at a large company.Oddly enough, customer service wasn't the worst part of the job. He barely had time to help customers due to all the tasks required just to tread water in the company's lumbering beast of an ERP system. All day long, he had to click the same buttons, generate the same PDF files, and send the same emails.This drudgery wasn't limited to Trace, either. Everyone in his department, from other young graduates to the most senior reps, performed the same grueling ritual. It'd been devised long before Trace was born, and it was taken for granted—right along with the resultant stress, weariness, and repeated mantra of "I'm too busy right now!"Trace saw no reason why the repetitive process couldn't be automated in some fashion, but Trace wasn't a programmer himself. Undaunted, he scheduled a meeting with his boss to go over his idea."Let's bring in someone who can write a program for this. It'll save lots of time and effort in the long run, which we can then use to help our customers." Trace smiled, excited by the prospect of making a real difference at his new corporate home.There was no crack in his manager's tired expression. "It's not an ideal process, sure, but it works. Besides, we don't have room in our budget to hire programmers."That was the day Trace learned that there wasn't a single sound suggestion in the universe that couldn't be shot down with the words, "There's no budget for that."He returned to his desk, discouraged. Just as he was about to plow back into his paperwork, he had a new thought. Wait, why can'tImake this happen? He wasn't a programmer, but that didn't mean he couldn't learn. Hadn't his college roomate always told him that 90% of his CompSci major came down to how well he phrased his Google searches?During downtime and after work, Trace began to teach himself how to code. At first, he'd learn operations and then copy/paste them like mad—he hadn't learned loops yet—but over time, the program gained sophistication. It could click buttons, create PDF files, send emails, and lookup and consolidate important information.It was time to show it to the team. Trace spent a few coffee breaks approaching people at their cubes, demonstrating his achievement. "Isn't this great?"Some of the newer coworkers saw the benefit at once. The more veteran employees frowned with confusion, scorn, or outright fear."Are you trying to get us all fired, kid? If you show this to management, we're screwed!""I don't have any control over this!""My way works for me!"Trace reluctantly left these folks to keep clicking the same buttons, generating the same PDF files, sending the same emails, and making the same old tired complaints about their workload. He learned another important lesson about how easy it was to become complacent with, and even dependent upon, the status quo.With that lesson firmly in mind, he spent his free time deepening his programming knowledge, refining his existing code, even throwing in a few loops. It paid off as his daily administrative chores became a matter of clicks rather than hours. Customers gave him great feedback because he had time to give their issues the attention they deserved.Over time, Trace climbed the ladder with promotions, and quietly shared his program with each new hire. Whenever they suggested process improvements of their own, he made sure to listen.[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
by Mark Bowytz on (#2EKJN)
Hugo K. writes, "Space Mountain is closed for refurbishment. It will reopen when all security patches are installed."
by Remy Porter on (#2EFMQ)
We get a lot of bad date code samples. Since we all learned to read a calendar in elementary school, everyone assumes they actually understand how dates work, and then tries to codify that knowledge in code. Bad date code is like entry level awfulness, and it takes a lot to surprise me when I see bad date handling code. Mike R knows how to do it, though. He found this code buried in a 30+ file commit, with the helpful commit message, “asdf;â€:
by snoofle on (#2EBC4)
Snoofle's tale is a little different than our usual Tales From the Interview, but these kinds of negotiating tactics are TRWTF. -- RemyAfter more than 3 decades in our field, I find my self in the position of being able to afford to retire, but not yet actually ready to retire. This is partly due to the fact that my wife still wants to work. While walking off into the sunset together seems enticing, biding my time until she's ready seems somewhat boring (for the unmarried, having too much fun while she's still at work, even by her choice, is not conducive to marital bliss).Once you realize that you've cleared the financial hurdles where the big bills like college tuition and the mortgage are paid and retirement is funded, your priorities at work change. For example, when you need to pay tuition and a mortgage, you are willing to put up with a certain amount of stupidity so that you can take care of your family. Once those bills are paid, your tolerance for idiocy shrinks quite a bit. To that end, I left my last job - for the first time - with no job to go to.While I'm waiting for my wife to decide to join me, I've decided that taking another job could fill the time. Since I no longer need the money, however, my criteria for taking another job are far more stringent than usual. Specifically, no more managers who offer randomly chosen delivery dates without taking the amount of work into account. No more places that deploy directly to production. No more tolerance for managers that say one thing and then do another, leaving you holding the bag. No more teams of one experienced person to fix the onslaught of wrong-ness inflicted by a bevy of inexperienced junior developers.As you might imagine, most of what crosses my in-box doesn't measure up. However, every now and then, something of interest (that seems to measure up) appears. The latest of these was a position as a highly experienced architect/developer at a non-financial company in NJ. The technology stack they were using was in line with my experience. The phone screen with the developers yielded some honesty about the differences between where they were and where they needed to be, but at least they recognized the shortcomings. It was a try-buy deal (usually a turn-off for me) with the numbers in the right range (e.g.: commensurate with my experience). I decided to go on the interview.Don't get me wrong; if I could find a good position at half the money, but near home, I'd grab it (convenience trumps income). Unfortunately, there's very little in the way of tech offerings near where we live. If I have to make the long daily shlep, then I feel it's only reasonable to be paid along the lines of typical salaries in the industry and location where I'll be working. The fact that I don't actually need the money is personal and should be of no consequence to the company who will be getting my services.The interview went well. A few days later the offer came, but at $50K less than what they had listed in the job posting. Upon querying, I was informed that although they said I had all the qualifications and experience they were seeking, they decided they only needed mid-level experience and so they adjusted the offer to reflect that. Although it's not about money, I don't like being taken advantage of, and declined based upon the discrepancy.The hiring manager called me to try and convince me to take the position as we had all hit it off and seemed to be on the same page. I said that it seemed that they wanted 30+ years of experience but were only willing to pay for 15 years of experience, and that since the number they originally discussed and the one they offered were so different, that I was not interested in giving it away (would they be willing to let me dumb down my skills, knowledge and experience to match the compensation, or did they want me to use all of my expertise to do the best job possible?)Of course he said the latter. He then pointed out that $50K wasn't that much money and it shouldn't be a deciding factor. I said that money wasn't the issue, but how they changed the terms on me after the fact was. I further pointed out that if it wasn't that much money, then I would take the job at the offered rate if he would personally make up the $50K difference.Naturally he railed at that suggestion.I pointed out that it was interesting that $50K was no big deal when it was coming out of my pocket, but it was a huge deal when it was coming out of his pocket; then I declined the offer.A few days later, he called me again and informed me that he got the budget to pay the originally agreed-upon rate.I am presently doing volunteer work, instead. If I'm going to take a paid position, it should be a fair wage given the skills/experience/location/industry/etc. I am not going to give it away. The fact that he tried to renege on a financial agreement just to make his budget look better - to me - is a huge warning sign that dealing with him would be an ongoing WTF, so I chose to pass on the position.When you have fiscal obligations, getting paid something - anything - is better than nothing, but we all know that someone who is qualified but underpaid is someone searching for a new position. When you have the luxury of not having monetary obligations, dealing with someone who treats you fairly and honestly trumps - pretty much - all.[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
by Remy Porter on (#2E7BM)
An anonymous reader was chatting with their fellow developers on Slack. They work for a telecom, and thus have to support software and hardware from a variety of vendors. In one Apple-provided API, they found this method.
by Erik Gern on (#2E3FP)
Dominique finished her instant cup of ramen, her third day straight. She and the other developers at Bento had gone a month without pay as they finished the beta version of their only application: a browser for promotional materials of yet-to-be-released merchandise.Her cellphone rang. It was CEO Stephen, who was wooing investors with a demo. “How hard is it to block a user from capturing a screen image?â€â€œIt’s possible,†she began. “We’d need to encrypt all copyrighted images that are stored to disk, disable the print screen button, disable the context menu when a user right-clicks–â€â€œGreat, thanks.†Stephen hung up.Stephen returned to the office an hour later. “We’ll need copy protection for a new demo next Monday,†he said.“I didn’t even get to the hard stuff,†Dominique replied. “Like screen capturing software. You’re talking about a dozen different applications we’d need to write fixes for.â€â€œSure, but you can do it by Monday, right? It’s the one thing they’re insisting on.â€The ListDominique assembled the other developers for a stand-up meeting. She wrote on the whiteboard:
by Mark Bowytz on (#2DSH5)
"Sure, it's a bit expensive, but hey, where else can you find a place with a huge outside baloney?" Keith S. wrote.
by Remy Porter on (#2DNJR)
For every line of code that ends up in software the general public sees or interacts with, for every line in your Snapchats and Battlezone: Call of Honor Duty Warfare, there are a thousand lines of code written to handle a supply chain processing rule that only applies to one warehouse on alternating Thursdays, but changes next month thanks to a union negotiation. Or it’s a software package that keeps track of every scale owned by a company and reminds people to calibrate them. Or a data-pump that pulls records out of one off-the-shelf silo and pushes them into another.That’s the “iceberg†of software development. In terms of sheer quantity, most software is written below the waterline, deep in the bowels of companies that don’t sell software, but need it anyway. That’s the world of internal software development.And internal software development, in-house software shops, have a problem. Well, they have lots of problems, but we’re going to focus on one today: Internal Billing and the Billable Hour.At a first pass, internal billing makes sense. If you are a widget manufacturer, then you want the entire company aligned with that goal. If you buy raw materials, those raw materials are going into widgets. If you pay laborers, their labor should be going into making widgets. If you buy capital assets, they should be things like widget-stamping machines.But you can’t just build widgets. Your workers need to organize via email. The new Widget-Stamper 9000 needs network connectivity, so you need network drops and routers and switches, which in turn need regular maintenance. This is, in pointy-haired-boss speak, “overheadâ€. You need it, but it doesn’t directly make widgets. It’s a cost center.So what do large companies do? Well, they take all those “non-productive†activities and shuffle them off into their own departments, usually in a “corporate SBUâ€. Then all the departments doing “real†work get a budget to spend on those “cost centersâ€. And thus, internal billing is born.Each employee needs an email account. Let’s assign that a cost, a rough—sometimes very rough—estimate of the total cost of managing the email account. Our corporate IT department will charge $20/yr per employee to cover the storage, configuration, management, and helpdesk support associated with their email account—and so on through the list of IT-related goods and services. Now the idea is that individual departments know their IT needs better than anyone else. By putting them in control of their IT budgets, they can spend their money wisely.If you’re a widget-making company, you view software and IT support as an overhead cost, and recognize that you only have the capacity to pursue a certain number of IT projects, this makes perfect sense. Budgets and billing create a supply/demand relationship, and they give corporate the ability to cut overhead costs by controlling budgets. (Of course, this is all founded on the faulty assumption that in-house software development is simply overhead, but let’s set that aside for now.)The problems start when internal billing meets software development, usually through the interface of the “billable hourâ€. The combination of these factors creates a situation where people who are ostensibly co-workers are locked into a toxic client/vendor relationship. The IT department is usually in a disadvantageous negotiating position, often competing against external vendors for a business department’s IT budget. Treating corporate IT as the preferred vendor isn’t all sunshine and roses for the business, either. There are definitely cases where external vendors are better suited to solve certain problems.Putting IT resources on a billable hours system introduces a slew of bizarre side effects. For one thing, hours have to be tracked. That overhead might be relatively small, but it’s a cost. “Idling†becomes a serious concern. If developers aren’t assigned to billable projects, the IT department as a whole starts looking like it’s being non-productive. Practices like refactoring have to be carefully concealed, because business units aren’t going to pay for that.Spending more billable hours on a project than estimated throws budgets out of whack. This forces developers into “adaptive strategiesâ€. For example: padding estimates. If you can get an extremely padded estimate, or can get a long-running project into a steady-state where no one’s looking too closely at the charges, you can treat these as “banksâ€. A project starts running over your estimate? Start charging that work against a project that has some spare time.Of course, that makes it impossible to know how much time was actually spent on a project, so forget about using that for process improvement later. It also makes every project more expensive, driving up the costs of internal development. This drives business users to seek external solutions, spending their IT budget outside of the company, or worse: to find workarounds. Workarounds like maybe just building a big complicated Excel spreadsheet with macros in it.This isn’t even always restricted to hourly charges, either. I saw one organization that had a charge-back rate of $10,000/yr for a SQL Server database. That wasn’t licensing or hardware, that was just to create a new database on an existing instance of SQL Server. The result? Pretty much no business unit had a working test environment, and they’d often stack four or five different applications into the same database. Rarely, they’d use schemas to organize their tables, but usually you’d have tables like: Users, Users_1, UsersNew, UsersWidgetsoft, ___Users.Forget about upgrades, even if they’re required. Short of making organization-wide modernization a capital project, no department or business unit is going to blow their IT budget on upgrading software that already works. For example, Microsoft still supports the VB6 runtime, but hasn’t supported the VB6 development environment since 2008. So, when the users say, “We need to add $X to the application,†IT has to respond, “We can’t add $X unless we do a complete rewrite, because we can’t support it in the state it’s in.†Either the business ends up doing without the feature or they make it a demand: “We need $X and we need it without a complete rewrite.†Then your developers end up trying to breathe life into a Windows 2000 VM without connecting it to the network in hopes that they can get something to build.Billable hours turn work into a clock-punching exercise. Billing time is how you’re judged, and whether or not that time is spent effectively becomes less relevant. Often, by the end of the week, employees are looking for ways to fill up their hours. This is a task that should be easy, but I’ve watched developers agonize over how much they’re going to lie to make their timesheet look good, and hit their “85% billable†targets. This gets especially bizarre since you’re not self-assigning tasks, but you have to have 85% of your time billable, and thus you need to take the tasks you’ve been assigned and spend a lot of time on the billable ones to make sure you hit your targets, turning five-minute jobs into ten-hour slogs.We could go on dissecting the problems with billable hours, and these problems exist even when we assume that you can just view your in-house software as a cost center. Some of these problems can get managed around, but the one that can’t is this harsh reality: software isn’t a cost center.I’ve heard a million variations on the phrase, “we make widgets, not software!†Twenty years ago, perhaps even ten years ago, this may have been true. Today, if you are running a business of any scale, it simply is not. It’s trite to say, but these days, every business is an IT business.One project I worked on was little more than a datapump application with a twist: the data source was a flow meter attached to a pipe delivering raw materials to a manufacturing process. The driver for reading the data was an out-of-date mess, and so I basically had to roll my own. The result was that, as raw material flowed through the pipe, the ERP system was updated in real-ish time with that material consumption, allowing up-to-the-minute forecasts of consumption, output, and loss.How valuable was that? It’s not simply an efficiency gain, but having that sort of data introduces new ways of managing the production process. From allowing management to have a better picture of the actual state of the process, to helping supply chain plan out a just-in-time inventory strategy, this sort of thing could have a huge change on the way the business works. That wasn’t a skunkworks idea, that wasn’t IT just going off and doing its own thing. That was a real hook for business process improvement.Smart companies are starting to figure this out. I’ve been doing some work for a financial services company that just hired a new CTO, and he’s turned around the “We make $X, not software,†and started his tenure by saying, “We are a software company that provides financial services.†Instead of viewing IT as a sink, he’s pushing the company to view IT as a tool for opening up new markets and new business models.So, yes, IT is a cost of doing business. You’ll need certain IT services no matter what, often fulfilled with off-the-shelf solutions, but configured and modeled to your needs. IT can also be a cost savings. Automation can free up employees to focus on value-added tasks.But the one that’s underestimated in a lot of companies is IT’s ability to create value-added situations. If you make widgets, sure, it’s unlikely that your software is going to directly change the process of making widgets, so it’s unlikely that your software is itself technically “value addedâ€. But a just-in-time supply chain system is more than just a cost savings or an efficiency booster. It can completely change how you manage your production process.By placing the wall of billable hours between IT and the business, you’re discouraging the business from leveraging IT. So here are a few ways that corporations and management could possibly fix this problem.First, as much as possible, integrate the IT staff into the business-unit staff. This might mean moving some corporate IT functionality out into individual departments or business units (if they’re large enough to support it), or dedicating corporate staff to a relationship with specific business units. Turn IT workers into a steady flat cost, not a per-hour cost. When trying to handle priorities and deciding how to spend this limited resource to get new software developed, business-unit management can set priorities.If an organization absolutely must use internal billing to set priorities and control demand for IT resources, move as much work as possible into fixed-rate, flat-fee type operations. If a business unit requests a new piece of software, build a fixed-bid cost for that project, not an hourly cost.While a “20% time†approach, where employees are allowed to spend 20% of their time on their own projects, doesn’t work in these kinds of environments, an organizational variation where some IT budget is used on speculative projects that simply might not work—a carefully managed skunkworks approach—can yield great benefits. It’s also an opportunity to keep your internal IT staff’s skills up to date. When you’re simply clocking billable hours, it’s hard to do any self-training, and unless your organization really invests in a training program, it’s easy to ossify. This can also involve real training, not “I sent my drones to a class, why don’t they know $X by now?†but actual hands-on experimentation, the only way to actually learn new IT skills.All in all: billable hours are poison. It doesn’t matter that they’re a standard practice, they drag your IT department down and make your entire organization less effective. If you’re in a position to put a stop to it, I’m asking you, stop this. If you can’t stop it, find someone who can. Corporate IT is one of the most important yet under-prioritized sectors of our industry, and we need to keep it effective.[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
by Remy Porter on (#2DHKQ)
We don’t receive many CSS-based submissions, possibly because CSS is already pretty horrible. There are real-world, practical things that you simply need to take a hacky, awkward approach with.Matthew found this code, however, which isn’t a clever hack to work around a limitation, and instead just leaves me scratching my head.
by snoofle on (#2DDNN)
Murray F. took a position as an Highly Paid Consultant at a large firm that had rules for everything. One of the more prescient rules specified that for purposes of budgeting, consultants were only allowed to bill for 8 hours of work per day, no exceptions. The other interesting rule was that only certain employees were allowed to connect to the VPN to work from home; consultants had to physically be in the office.The project to which Murray was assigned had an international staff of more than 100 developers; about 35 of them were located locally. All of the local development staff were HPCs.With that much staff, as you would expect, there was a substantial MS Project plan detailing units of work at all levels, and assorted roll-ups into the master time line.The managers that had created this plan took all sorts of things into account. For example, if you attended three hours of meetings two days a week, then you only had 34 hours available for work; if you had to leave early one day to pick up your kid, it set those hours aside as non-work, and so on. The level of detail even took into account the time it takes to mentally put down one complex task and pick up another one. It was awful to look at but it was reasonably accurate.Until...Weather forecasters are wrong as often as they are right. However, the spiraling pin-wheel of snowstorms was getting bigger and barreling down on the local office, and was so imminent that even the forecasters were issuing absolute warnings. Not "It looks like we might get six inches"; but more along the lines of "Get groceries and plan to be shut in for a while".The storm hit at night and by first light, anyone who looked out the window immediately realized that the forecasters were right and that they weren't going anywhere. In an attempt to be good team players, the consultants called their managers, pointed out that they were snowed in and unable to travel, and given the special circumstances, could they use the VPN and work from home?The managers all responded that the rules were very specific and that the consultants could only work from the office. Since the consultants were powerless to do anything about the weather or the mountain of snow that had to be shoveled, they took snow days and no work was done.That's 35 consultants for 2 days or 70 days of (loaded) work, or about 2 ½ months of work that vaporized. Needless to say, this turned the otherwise green time line quite red.The managers called a meeting to discuss how to make up the time. Their first suggestion was that the consultants put in more time, to which they responded The rules specify that we cannot bill more than 8 hours each day. The managers then asked the consultants if they would work without pay - to get it done. Wisely, the consultants said that they were required to play by the rules set forth by the company, and could not falsify the billing sheets with the wrong number of hours worked.The sponsoring agencies of the consultants all agreed on that one (free labor means no commissions on said labor).This went back and forth for a while until it came time for scheduled demos. Only the work was about ten person-weeks behind schedule and the features to be demo'd had not yet been built.At this point, the senior people who could not see their expected features in action had no choice but to address the snow delay. After much discussion, they decreed that the budgets had to be adhered to (e.g.: billing was limited to 8 hours per day), but the line development managers could hire additional consultants to make up the missed work. The managers got to work adjusting the master project plan.The existing consultants pointed out that it would take a substantial amount of time to find new consultants, get computers, set up development environments, do general on-boarding and get new developers up to speed; and that it didn't make sense to hire new developers for something like this.It was decreed that rules had to be followed, and it didn't matter if it wasn't cost efficient to follow those rules.So they spent about a month interviewing (new project task for existing senior consultants and managers), bringing new consultants on board (getting them equipment, access, etc. - a new project task for managers) , and giving them architecture and code walk-throughs (new project task for existing senior consultants). This necessitated increasing the expense to the project to cover all the additional overhead.All to save a few bucks in additional billing by already-trained-and-equipped developers, which would have been completely unnecessary if they had just let them work from home in the first place.But hey, those were the rules. [Advertisement] Application Release Automation – build complex release pipelines all managed from one central dashboard, accessibility for the whole team. Download and learn more today!
by Remy Porter on (#2DA4T)
PastorGL inherited some front-end code. This front-end code only talks to a single, in-house developed back-end. Unfortunately, that single backend wasn’t developed with any sort of consistency in mind. So, for example, depending on the end-point, sometimes you need to pass fields back and forth as productID, sometimes it’s id, productId, or even _id.Annoying, but even worse is dealing with the dreaded date datatype. JSON, of course, doesn’t have a concept of date datatypes, which leaves the web-service developer needing to make a choice about how to pass the date back. As a Unix timestamp? As a string? What kind of string? With no consistency on their web-service design, the date could be passed back and forth in a number of formats.Now, if you’re familiar with the JavaScript Date datatype, you’d know that it can take most date formats as an input and convert them into a Date object, which gives you all the lovely convenience methods you might need. So, if for example, you wanted to convert a date string into a Unix timestamp, you might do something like this:
by Mark Bowytz on (#2D0GT)
"Web design pro-tip: If it takes a while to load data, just put an 'Animated loading spinner' on the screen," wrote Stuart L.
by Remy Porter on (#2CWJP)
Today, we present our second installment of Software on the Rocks, complete with new features, like an actually readable transcript done by a professional transcriber. Isn’t that amazing?In today’s episode, Alex and Remy host a special guest, Justin Reese, founder of Code & Supply, one of the largest developer community organizations out there, with a nearly constant stream of events. In this episode, we discuss what building a community is like, when is it fair to really tear into bad code, and that time Alex made 10,000 people late for work.This episode of Software on the Rocks is brought to you by Atalasoft.MP3Web PlayerTune in two weeks, when we’ll have Jane Bailey, one of our writers, to discuss working for the site and the perils of “Programmer Anarchyâ€. Follow future episodes here on the site, or subscribe to our podcast.TranscriptAlex: I guess this is another podcast we’re doing.Remy: We are doing this again, and you know what? Not only are we doing this again, Alex, but we have brought a friend. This is Remy Porter, editor of The Daily WTF. We’ve got Alex.Alex: Hello, everyone. Hello, Remy.Remy: And we have with us Justin Reese. So, uh, Justin, why don’t you tell us a little bit about yourself?Justin: Oh. Oh, no. Remy met me through Code & Supply, which is an organization that I started to kind of foster a strong software community here in Pittsburgh.Alex: What sort of things do you do?Justin: Well, so, Code & Supply started because there were lots of disparate meet-ups around the city and just holding events. And there were some really small ones that had great ideas and great people involved but they were really small and they were susceptible to one person failing to do something. And the whole community around a language would die in the city. So, I wanted to make a stronger organization, bring on sponsorship money, and pay to do really cool things, and it just kind of –Alex: And so, this is all Pittsburgh-based, all Pittsburgh local. It sounds like a pretty interesting idea.Justin: Yeah, along with something like 8 to 12 events every month, we held Abstractions this year. You know, it was a very, very large conference.Alex: Oh, that was your conference?Remy: That was his conference. I was an attendee. I just showed up. This was an amazing conference.Justin: What’s really amazing is, like, we had a lot of people there. We’re really focused on creating connections between people, so we – The whole focus was building a bridge between, like, a design community, the ops community, the development community into one thing. But we ended up doing some really amazing things, like Larry Wall, the inventor of Perl, for the first time ever, meeting Joe Armstrong, the inventor of Erlang.Alex: Now, Justin, is Abstractions a not-for-profit or – This whole Code & Supply thing, like, is this someone’s full-time job? I mean, it sounds almost hobby-like, but then, you know, a conference – that’s, like, gone beyond a hobby. You know, there’s some real risks you have to take on to do that.Justin: That’s kind of the reason behind Code & Supply, though, is so that the risk is minimized a little bit. I signed contracts with venues and things that would have financially ruined me if something went wrong, but, you know, having Code & Supply as an organization at least protects me, personally, a little bit.Alex: And just to be clear, when you say, “huge financial risks and liabilities,†you know, this is the thing with conferences that always amazes me, right, is that, you know, we’re talking, like, hundreds of thousands of dollars. And why take on all that liability for, effectively, a hobby?Justin: Alex, you have a pretty good point. It is –You know, I mean, it is, to a point, fun, and I’d love to get to a point where I can make it my full-time job. It’s not quite there yet, but, you know, all the money we’ve made so far has been re-invested into our community. So, we took that Abstractions money that we made and we signed up for a really long lease for a community center so that we can have a place to hold events in perpetuity. And most of the time, I’m making decisions based on how to make the community more welcoming, ‘cause growth is kind of what makes Code & Supply awesome, is its incredible size to do really fantastic events. To grow, you got to be welcoming and get all the people involved.Alex: Now, Justin, I’m actually in the midst of organizing my own conference here. Well, I shouldn’t say “my own.†It’s DevOpsDays Tokyo. And this is one of the same issues that we’re facing is this whole notion of being open and being welcoming. The things that I see a lot are the elitism.Justin: Alex, I think that combating that feeling of elitism is kind of important. You know, we’re a polyglot community, and that means a lot of language, so people make choices for different reasons, and that “best tool for the job†mentality really goes a long way.Remy: And so, Justin, what would you say to the – there’s this one kind of tribe of elitists I see. They’ll grab code samples from other people’s codebases, usually offered by a disgruntled co-worker, and then they’ll post these code samples on a website. They, like, have this “Code Sample of the Day,†and they do these very critical code reviews. I don’t know. I feel like these people could be part of the problem.Justin: Remy, are you talking about something specific?Remy: I’m talking about The Daily WTF.Justin: Yeah, yeah, yeah, yeah. That’s –Alex: Oh, hey. That’s –
by Remy Porter on (#2CRFB)
There’s an old saying, that if your code is so unclear it needs comments to explain it, you should probably rewrite it. Dan found this code in a production system, which invents a bizarre inversion of that principle:
by Remy Porter on (#2CN53)
You may remember our new sponsor, Hired. To help them match up talent with employers, they’ve created their own proprietary dataset about salary and hiring trends, and have published their annual report about what they’ve found.There are a few key things in this report. First, as we all know, you don’t need to go to Silicon Valley for a good job in the tech sector- and even though the salaries are among the highest at an average of $134K a year, with cost of living factored in, even the notoriously expensive New York and LA can give you an advantage in purchasing power.If you are thinking of a move, the hot cities are Austin, Singapore and London. Non-local candidates are getting more offers at higher salaries than anywhere else. Even if you don’t want to go to one of those cities, in 12 of Hired’s 16 markets are offering better salaries to relocators.Age and race still matter. While African-American candidates are actually more likely to get hired, that may be because they’re being hired at a much lower salary than white candidates. Latino and Asian candidates ask for salaries comparable with white candidates, and are both less likely to get hired.If you’re between 25 and 30, you’re much more likely to get an “average†job offer for your experience level, but past 45, you’ll start to see a decline.There’s a lot more in here, including lots of global data. Read the white paper yourself, and if you think you could take advantage of these trends, get on Hired today and get some offers. [Advertisement] Otter, ProGet, BuildMaster – robust, powerful, scalable, and reliable additions to your existing DevOps toolchain.
by Jane Bailey on (#2CMFE)
During the interview, everything was gravy. Celestino Inc. was doing better business than ever before, and they were ready to expand their development center. They had all the keywords Gigi was looking for: Java 8, serving up a SPA for a hot new streaming product, outsourced from a company with money to burn but no developers of their own. She loved the people she'd interviewed with; they were smart people with great ideas. It'd been a long, grueling job hunt, but it'd been worth it. Gigi was eager to work with the technology, not to mention having plenty of budget and a greenfield to work with.By the time Gigi started work, however, the deal had fallen through. The big name with the budget had gone elsewhere, leaving Celestino in the dust. Gigi's boss seemed surprised to see her. He assigned her to work on bug duty for their 7 year-old Java product instead.A few minutes of settling in, and Gigi found the Jira for the product. She clicked through to "Unresolved issues" ... and nearly fell out of her chair. There were 8,800 bugs.That can't be right! she thought. Maybe they're not setting a resolution when they close them?But there was no such luck. Clicking into a dozen or so of the older ones revealed that they'd been filed years ago and never opened.Where do I even start? she wondered."I'll give you an easy one," said the manager, when asked. "Just fix this one thing, without touching anything else, and we'll get it rolled out to prod in the weekly release. Be careful not to touch anything else! We've had guys in the past who broke stuff they didn't realize was there."The bug did look easy, at least: if one chose a red background in the app, the text "looked funny". Gigi had no trouble reproducing the effect 100% of the time. All she had to do was find the offending line of code and tweak it. No risk of introducing extra bugs.And it was a snap—of her patience, not her fingers. The codebase had 133,000 source files implementing 3,600 classes, all just for the backend part of the application. She found a surprising number of places calling TextOut() that could've produced the text she saw, and the code was, of course, awful to read.Gigi gave up understanding it and tried the old standby: a binary search of the codebase by commenting out half the instances and seeing if the "funny" text still appeared. Six comments were inserted, and the code recompiled, taking 20 minutes. Gigi had been warned that if she tried to run make all, it'd take six hours, but that the build script was reasonably reliable—"reasonably" being the operative word.Still, it compiled, and she booted up the app. In theory, if the problem was in the six output statements she'd commented out, she'd see no text; if it was in the six she'd left alone, it'd still appear.She never anticipated a third outcome. The red background was gone, indicating that the output was in the commented half ... but instead of nothing, she saw two copies of the text that'd been hidden behind the red background, both reading the same thing, but in different fonts and different positioning.Gigi stared at the screen, a sinking feeling in the pit of her stomach. A vivid daydream flashed across her eyes: she envisioned packing up her purse, walking out the doors into the sunshine, and never returning. Maybe, if she were feeling generous, she'd call and explain she'd been deported to Mars or had suffered a violent allergic reaction to the application or something.It was her first day, after all. Nobody would miss her. Nobody depended on her yet. Nobody ...She flipped open her cell phone, staring at the lock screen: a picture of her husband and year-old son. They were counting on her. She needed to stick it out at least long enough to look good on her résumé and help her get the next job. She could do this for her family. She had to be brave.Taking a deep breath, Gigi resumed her herculean task. She commented out a few more text outputs, hoping to figure out which of them was causing the effect. After another build and run, there was no text—but the text box twitched and flashed alarmingly.There's at least three layers of bug here! How am I meant to solve this without touching any unrelated code?!Gigi turned back to the Jira, realizing now why so many of these defects were ancient and still unopened as she set the bug back to "todo" status and went to find the manager.The next defect she was able to resolve, putting her back on solid ground. Not that it'd been easy—the problem was in a button event handler, spread across six source code files. The first file created an object and a thread; the next file scheduled the thread in a private queue. The third class hooked the thread up to the button, while the fourth class caught button clicks and scheduled another thread to handle the event. There were a few more layers of passing data around between files, until finally, another thread was queued to destroy the object. But once she got her head around the architecture, the bug was a simple typo. Easy enough to resolve.A week later, an email came through: some contractor in Siberia had resolved the first bug ... by upgrading the video drivers. Apparently there was a known issue with layering visible text on top of invisible text, with or without the red background.Why was the invisible text there? What did it have to do with a red background? What unearthly combination of branches created that particular display?Gigi didn't know or care. She was too busy filling out applications on Monster.com. Résumé be damned, she needed to escape. Maybe she'd just leave this one entirely off.[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
by Remy Porter on (#2CGFN)
An email from Andrea Ci arrived in our inbox, with nothing more than some code and a very simple subject line: “VB Conversion: a year in hellâ€.A lot of people have that experience when encountering Visual Basic code, especially when it’s VB6, not VB.Net. Even so, could it really be that bad? Well, let’s look at the sample Andrea provided.