Welcome, Guest. Please login or register.
March 28, 2024, 09:28:15 am

ballp.it is the community forum for The F Plus.

You're only seeing part of the forum conversation. To see more, register for an account. This will give you read-only access to nearly all the forums.

Topic: Thread.setTitle("Programmers Anonymous");  (Read 60698 times)

Zekka

  • I AM IN INTO MATHEMATICAL CALCULATIONS AND MANY METHODS USED IN THE STOCK MARKET
  • Paid
    • 872
    • 54
This program is designed to be used by hundreds of thousands of people.

Obviously, in addition to using two other implementations of json that actually comply with the spec, we wrote our own, Featuring logic such as:
  • to convert a JSON string to a JVM string, cut off the first and last character
  • to convert a JVM string to a JSON string, add a quote before and a quote after

Interestingly enough, this application (which is open-source) deals with user input.

McShrimpsky

  • The Kelly Clarkson of Pornhub.com
  • Paid
  • 21
  • 3
Woof.  That's always fun.  Someone on the team we're working with decided that our functional tests should run in Javascript, and that everything should use promises, even though all the tests are run sequentially and none of them do any asynchronous stuff.  At some point in the distant future we may want to run test suites in parallel or something, but for now we're writing asynchronous code that runs sequentially and it's totally unnecessary and annoying.

FWIW, there are a lot of languages that have static typing and not classes. "Languages like Java" vs "Languages like Python" is kind of a false choice.
Zekka, July 29, 2016, 01:22:24 pm
I didn't mean to imply that it was a choice between the two, and those things were the deciding factors.  Java and Python are just the two languages I've used the most (with Clojure a distant third... anyone else here do much in Lisp?), and there are things I like and dislike about each.  I'm not even sure if I prefer static typing over dynamic typing, it's just reassuring to have the compiler enforce that kind of stuff for you sometimes.

Emperor Jack Chick

  • he/him
  • Ridiculist
  • Metal tyrant from hell
  • 3,193
  • 666
Woof.  That's always fun.  Someone on the team we're working with decided that our functional tests should run in Javascript, and that everything should use promises, even though all the tests are run sequentially and none of them do any asynchronous stuff.  At some point in the distant future we may want to run test suites in parallel or something, but for now we're writing asynchronous code that runs sequentially and it's totally unnecessary and annoying.
McShrimpsky, July 29, 2016, 03:33:54 pm

that is literally what i do all day

A Whirring Bone-White Gleech

  • fact-lord
  • Paid
  • I was in first place, you whore!
  • 720
  • 155
Thread.setTitle("Programmers Anonymous"); #48
So the way to write Rust is to pretend you're writing Scala or Haskell or something, never an OO language, and just be as minimal as possible.  Once the borrow-checker starts arguing with you, throw your computer out the window or just write some nice Python instead.  Or maybe do something nice for yourself, like play video games or hang out with your friends.  Anything but program in Rust.  It's not a C-killer and it's not revolutionary.  It's just syntactic salt and syntactic sugar in the same jar.
Nifty Nif, July 23, 2016, 03:36:29 pm

Me trying to sound smrt: that reminds me a lot of my experiences with Ada.  It's an efficient, low-level compiled language, that's much safer (and syntactically a lot clearer) than C.  And it's got some really neat stuff in it.  But it's also trying to be a lot safer than C, with minimal run-time overhead, and they did it with a compile-time type system that is a bloody horror to deal with.  The system is so inflexible that people are more likely to circumvent it rather than use it as intended, which renders the resulting Ada code vulnerable to all the same problems the equivalent C code would have been, which in turn makes the whole exercise sort of meaningless.
Nifty Nif

A Whirring Bone-White Gleech

  • fact-lord
  • Paid
  • I was in first place, you whore!
  • 720
  • 155
Thread.setTitle("Programmers Anonymous"); #49
C++ is a language where it is difficult to write a function that returns an array of arrays of integers, if you don't know how big each array is going to be or how many there are at compile time.

I have settled on std::vector< std::vector<int> > which will work but I feel like is kind of absurd.

Fuck this language.

edit: having to push_back onto the vectors got to be more irritating than it was worth, now I have no idea what I'm going to do.
edit 2: std:array and boost:array both take their length as a template parameter which super helpfully means that their length must be a compile-time constant.  This prevent me from using them right now, in a situation where their size is an argument - an argument that could be a constant over the course of the function, but just marking it const doesn't make it constant enough.  WHICH FROM WHERE I SIT SEEMS TO DEFEAT THE WHOLE FUCKING POINT.
Gyro Nifty Nif
« Last Edit: September 05, 2016, 08:30:08 pm by Der Trommelngleech »

Emperor Jack Chick

  • he/him
  • Ridiculist
  • Metal tyrant from hell
  • 3,193
  • 666
Thread.setTitle("Programmers Anonymous"); #50
so the other day i'm happily running my automation when it starts breaking, even though the test was working just a few minutes ago. Dig down a little bit and my SUPER GOOD code is breaking between the hour of 5-6pm because reasons. Now part of the handler for this code was in a ternary statement, and so I figured I'd just slap an OR in there and add another ternary. It looked kinda like this ((d.getHours == 0 ? d.getHours + 12 : d.getHours) || (d.getHours < 12 ? d.getHours -12 : d.getHours)).  So I sent that to one of my developers who is a quiet, sarcastic kid, and he just sends back "OMG WHAT THE FUCK IS THAT". So I go up and start explaining to him why my code is breaking between 5-6pm, and he's cracking up. He opens up the date handler for the actual platform I'm writing automated tests against and it was written with about 3 more layers of abstraction than necessary in order to do the modifications I need to support. We then discover that there are several functions in the date handler that do not have any references to them at all.

About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"

Professional software development in a nutshell.
Gyro

Runic

  • Is Putting A Donk On It
  • Paid
  • John Brown did nothing wrong
  • 2,951
  • 69
Thread.setTitle("Programmers Anonymous"); #51
What a magical industry I am heading towards!

Gyro

  • touched fuzzy, got dizzy
  • Paid
  • 830
  • 55
Thread.setTitle("Programmers Anonymous"); #52
C++ is a language where it is difficult to write a function that returns an array of arrays of integers, if you don't know how big each array is going to be or how many there are at compile time.

I have settled on std::vector< std::vector<int> > which will work but I feel like is kind of absurd.

Fuck this language.

edit: having to push_back onto the vectors got to be more irritating than it was worth, now I have no idea what I'm going to do.
edit 2: std:array and boost:array both take their length as a template parameter which super helpfully means that their length must be a compile-time constant.  This prevent me from using them right now, in a situation where their size is an argument - an argument that could be a constant over the course of the function, but just marking it const doesn't make it constant enough.  WHICH FROM WHERE I SIT SEEMS TO DEFEAT THE WHOLE FUCKING POINT.
Der Trommelngleech, September 05, 2016, 06:40:17 pm

std::vector<thing> is the real array type in C++. It's kind of fucked, but at least it has a variable defining its length at run-time. I'd recommend going with that. I believe there's a .set(index, value) (or .set(value, index), I forget the signature) method on vectors, they can be treated as arrays. Better than calling push_back() all over the place. I think they have iterators too? I'll check when I get home.

But, yeah, it's a fucking mess. 

duz

  • Paid
  • 659
  • 19
Thread.setTitle("Programmers Anonymous"); #53
so the other day i'm happily running my automation when it starts breaking, even though the test was working just a few minutes ago. Dig down a little bit and my SUPER GOOD code is breaking between the hour of 5-6pm because reasons. Now part of the handler for this code was in a ternary statement, and so I figured I'd just slap an OR in there and add another ternary. It looked kinda like this ((d.getHours == 0 ? d.getHours + 12 : d.getHours) || (d.getHours < 12 ? d.getHours -12 : d.getHours)).  So I sent that to one of my developers who is a quiet, sarcastic kid, and he just sends back "OMG WHAT THE FUCK IS THAT". So I go up and start explaining to him why my code is breaking between 5-6pm, and he's cracking up. He opens up the date handler for the actual platform I'm writing automated tests against and it was written with about 3 more layers of abstraction than necessary in order to do the modifications I need to support. We then discover that there are several functions in the date handler that do not have any references to them at all.

About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"

Professional software development in a nutshell.
jack chick, September 05, 2016, 11:16:36 pm

Yep, that sounds about right.

Gyro

  • touched fuzzy, got dizzy
  • Paid
  • 830
  • 55
Thread.setTitle("Programmers Anonymous"); #54
About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"
jack chick, September 05, 2016, 11:16:36 pm

What the fuck does that even MEAN?

It sounds like it's a static table of a few common roles for optimization's sake and then the rest of them would be handled dynamically, but it also sounds far stupider than that, so I don't know.

Captain Capacitor

  • Paid
  • 24
  • 5
Thread.setTitle("Programmers Anonymous"); #55
Hello thread. I have a confession.

I work for Microsoft. I don't write Microsoft code. Ask me things I might answer. I am also mostly made of alcohol at the moment.
« Last Edit: November 01, 2016, 02:19:37 am by Captain Capacitor »

A Whirring Bone-White Gleech

  • fact-lord
  • Paid
  • I was in first place, you whore!
  • 720
  • 155
Thread.setTitle("Programmers Anonymous"); #56
Lists are the “bread and butter” of Haskell collections. In an imperative language, we might perform a task many items by iterating through a loop. This is something that we often do in Haskell by traversing a list, either by recursing or using a function that recurses for us. Lists are the easiest stepping stone into the idea that we can use data to structure our program and its control flow. We'll be spending a lot more time discussing lists in Chapter 4, Functional programming.
Real-World Haskell: The Title is a Lie

Oh god, is that their trying-way-too-hard-to-be-positive way of saying "we're way to pure-functional to support something as vulgar as a for-loop"?  Am I going to have to write a recursive function every time I want to iterate over a list?

Jesus Christ, I thought people learned not to do this shit when the only real-world project to use Common Lisp was EMACS.
« Last Edit: February 24, 2017, 03:00:02 am by Der Trommelngleech »

Zekka

  • I AM IN INTO MATHEMATICAL CALCULATIONS AND MANY METHODS USED IN THE STOCK MARKET
  • Paid
    • 872
    • 54
Thread.setTitle("Programmers Anonymous"); #57
Haskell has monster cockogues for foreach (through map, foldr, and forM_) and for while. (through unfold and iterate) They're not that bad in practical use.

You possibly won't like these constructs, but they're what Haskell has.

junior associate faguar

  • Frankly, an unreasonable level of uguu~
  • Paid
  • 446
  • -44
Thread.setTitle("Programmers Anonymous"); #58
Lists are the “bread and butter” of Haskell collections. In an imperative language, we might perform a task many items by iterating through a loop. This is something that we often do in Haskell by traversing a list, either by recursing or using a function that recurses for us. Lists are the easiest stepping stone into the idea that we can use data to structure our program and its control flow. We'll be spending a lot more time discussing lists in Chapter 4, Functional programming.
Real-World Haskell: The Title is a Lie

Oh god, is that their trying-way-too-hard-to-be-positive way of saying "we're way to pure-functional to support something as vulgar as a for-loop"?  Am I going to have to write a recursive function every time I want to iterate over a list?

Jesus Christ, I thought people learned not to do this shit when the only real-world project to use Common Lisp was EMACS.
Der Trommelngleech, February 24, 2017, 02:58:27 am

Real World Haskell is quite outdated and pretty awful in general. Haskell Programming from First Principals is much better.
A Whirring Bone-White Gleech

A Whirring Bone-White Gleech

  • fact-lord
  • Paid
  • I was in first place, you whore!
  • 720
  • 155
Thread.setTitle("Programmers Anonymous"); #59
Haskell has monster cockogues for foreach (through map, foldr, and forM_) and for while. (through unfold and iterate) They're not that bad in practical use.

You possibly won't like these constructs, but they're what Haskell has.
Zekka, February 24, 2017, 12:19:38 pm

I kind of remember these things from Common Lisp.  Python3, my one true love, also has, for example, map, filter and apply.  They weren't really good substitutes for just having a for loop.  They weren't really the best solution for the problem they were trying to solve, either: they've been more-or-less deprecated by list comprehensions (and generators), which do the same thing far more cleanly (IMO).

For the casual reader, this is a Python list comprehension:
roots = [ math.sqrt(x) for x in numbers ]

I get what map does and I still think that saying "you don't need a for-loop because we have map" is pretty dumb, is what I'm trying to say.


Real World Haskell is quite outdated and pretty awful in general. Haskell Programming from First Principals is much better.
journeyman faguar, February 24, 2017, 03:21:53 pm

Thanks very much for the tip!  I'm all for doing things the most current/refined way first.  =)
« Last Edit: February 24, 2017, 08:03:56 pm by Der Trommelngleech »