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

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



MisterZimbu posted:

I love unnecessary string manipulation/conversions. Seen both of these in production code at current job:

code:
int a = 1;  int b = 2;
if (a.ToString() == b.ToString()) { ... }
code:
object result = datareader.GetValue("column");
return Convert.ToInt32(result.ToString());

Why the hell would you even do this?

Adbot
ADBOT LOVES YOU

F_Shit_Fitzgerald
Feb 2, 2017



MisterZimbu posted:

Because 95% of programmers are not bright people.

And here I've been worried about not being able to make it as a programmer in the "real world" (I'm a hopefully-soon-to-be-graduating CS major). If this is the kind of stuff that gets into production code, I'll probably be fine.

F_Shit_Fitzgerald
Feb 2, 2017



CS is a very math-y major that desperately wants to be seen as an engineering discipline like its bigger brothers EE and ME.

F_Shit_Fitzgerald
Feb 2, 2017



OddObserver posted:

Depends a lot on individual group. Like I don't think anyone using denotational semantics would pick engineering over math....

Yeah, I'll admit that I'm looking at it from the perspective of someone who studied CS in a mostly software-oriented context. I don't know all that much about them but I'd imagine that ML and robotics are 'harder' engineering than coding.

F_Shit_Fitzgerald
Feb 2, 2017



My experience is the opposite of everyone else's. My alma mater taught us C++ almost exclusively when I was there in the mid '10s, with a little Java here and there. I think the idea was that learning C++ would teach you the technical fundamentals of data structures (since you have to do a lot of set up and break down work yourself) before you learn a language like Java that does a lot of the grunt work for you.

I came out of my university experience a better programmer, but it's rare when I see a coding job that requires C++. Everything now is either Python or Java.

F_Shit_Fitzgerald
Feb 2, 2017



I took an algorithms and data structures course with an assignment pretty similar to that one (maybe the same school as OP? I'm not sure but probably not :tinfoil:). While we were only operating on relatively bite-sized blobs of data (say, a spellchecker program), I don't think my professor would have failed us for slow code. The point was more to understand how to use the map interface and iterators than getting the perfect O(n log n) runtime.

My school also used C++ for CS courses and only touched fairly briefly on Java. A friend who was pursuing a graduate degree in CS in another school thought that was odd, since C++ is relatively 'old hat' these days (now Java is relatively 'old hat' in comparison to Python).

F_Shit_Fitzgerald
Feb 2, 2017



QuarkJets posted:

If every assignment in an algorithms course can be completed by just writing the dumbest slowest poo poo then what's the point in taking an algorithms course

True.

Adbot
ADBOT LOVES YOU

F_Shit_Fitzgerald
Feb 2, 2017



Long before I was aware of modulo (one of the all-purpose tools in a programmer's toolbox), I came up with what seemed at the time like a foolproof method for determining divisibility:

1. Divide a number by its possible divisor (e.g: 172 / 5).
2. Convert the result into a string.
3. Iterate through the string to look for a decimal.
4. If no decimal is found, the number is divisible.

e: I didn't read Qwertycoatl's post closely enough. Guess I was on the right track if variations of this trick have been seen in "real" production code.

F_Shit_Fitzgerald fucked around with this message at 22:22 on Mar 7, 2024

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