u/Phen - 10 Archived Voat Posts in v/programming
u/Phen
  • home
  • search

u/Phen

1 post · 9 comments · 10 total

Active in: v/programming (10)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: Weird Python Integers

(and hopefully immutable!)

Nothing is immutable with malicious reflection! Just nudge the prival final value field to sow great confusion. http://www.docjar.com/html/api/java/lang/Integer.java.html

Even more fun, you can even change the toString() output of ints without trouble. The chars used for toString()ing are stored in an array (digits field) which can be updated, so that you can have int 0 output as "7", for example, and then 10 as "17".

I can dig up the code for this if you want to see, but it's also fun to figure out on one's own.

2 10 Sep 2017 12:58 u/Phen in v/programming
Comment on: [rant] Somethings you'll learn in college but should NEVER use in the real world

Linked lists have O(1) random insertion (if you're already at your link node), array lists do not. Array-based lists have O(1) random access, linked lists do not. The correct choice depends on the workload.

Nearly all lists I work with on a day-to-day basis are just collections to be iterated over for some sort of processing like validation or whatever. Algorithmically, either would be fine. Array lists have a lower memory overhead, so it's reasonable that they should be chosen for most cases, especially if you have a good idea of the buffer size.

But they certainly should not be chosen for ALL workloads.

For example, the application I write at work maintains a navigation stack. Depending on user action, we may need to remove the head or tail of the stack, pop or push navigation states. If the user navigates to a screen, we push the screen on the top of the stack and pop the tail so that we don't keep too much history. As the user goes back and forward, the list node moves to previous or next. Etc. How is that stack implemented? A linked list, of course! Anything else would be silly. It could have be implemented as an array list, after all the number of elements is so small that there would be no measurable performance impact. But we'd just have to write an interface overtop of the array-based list that looks the same as what the linked list already provides, so why bother?

HOWEVER, I think all of that misses the point of education entirely. Even if the linked list isn't used all over the place, you still need to understand the algorithms! That's the point of education. A college education in programming shouldn't just be bunch trade school style instructional courses where you're told what to do and how to do it. You have to understand the abstract data structures, why they're used, why they behave as they do, why you should use them, why you should avoid them.

If you don't, you'll risk winding up like my coworker who uses linear lookups for everything even when hashtables are the obvious solution. (Curse you LINQ!)

7 24 Jan 2017 01:42 u/Phen in v/programming
Comment on: How important is Algebra in computer programming

I agree. I was typing up my thoughts and then realized that they just echo yours:

The raw mechanics of algebra don't come up all too often, but I would nevertheless argue that understanding algebra is critical to becoming a good programmer. In learning and practicing algebra, you learn and practice abstract problem solving skills. You break the requirement to use "empirical" values solve specific problems and instead develop the skills to create generalized solutions. Your brain needs this practice. (Which is why it doesn't come easy!)

Every once in awhile, though, you do end up leaning on some old-school algebra to simplify some code. You'll be able to quickly recognize the availability of such a simplification thanks to practicing algebra.

Personally, I would be very suspicious of hiring a programmer who never mastered the concept of manipulating symbols under mathematics.

2 01 Nov 2016 21:15 u/Phen in v/programming
Comment on: Your opinion about Java: now and in the future on the labour market

Java is strong but conservative. Many would argue conservative to a fault. In general it is a very stable and consistent platform with few unexpected surprises.

Most all of my major work has been written in Java or C#. I haven't had the luxury of playing with a version of Java past 7, so I know I'm missing out on some of the very cool features that C# has had for a while. However, when it comes to a platform and environment as a whole, .Net by comparison doesn't have a lot to offer that Java doesn't already have in triplicate. And Java has sane data structures in its built-in library that .Net still oddly lacks.

Nevertheless, as far as employment goes, Java is totally worth your time. Furthermore, nearly all Java skills are translatable to C# (by design). Double the value!

3 04 Feb 2016 03:44 u/Phen in v/programming
Comment on: Perl 6 Is Fun

Try some

- $Hate
1 30 Nov 2015 23:31 u/Phen in v/programming
Comment on: Linus Torvalds is tired indeed of "trivially obvious improvements" that are actually buggy

What commercial software company do you work for? It sounds awesome!

2 12 Sep 2015 00:47 u/Phen in v/programming
Comment on: Coder vs Programmer

What a useless division. I engineer and develop software programs with code.

This isn't going to turn into those stupid fights of the words "nerd", "geek", and "dork", is it?

15 05 Jul 2015 17:07 u/Phen in v/programming
Comment on: Traffic Jams in Javascript

Very interesting article! I hadn't heard of Braess’s paradox before, although I do recall studies on the congestion of panicked rats on "one-lane roads" versus "multi-lane roads" where they have the opportunity to push and shove each other.

The comments on if smartphone-aided drivers could cause more extreme oscillation were quite thought-provoking. By always knowing the global immediate congestion state without also knowing either the future congestion state or (equivalently) peer routing decisions, aided drivers would almost necessarily cause congestion problems on contended, congestible roads!

2 20 Jun 2015 18:15 u/Phen in v/programming
Comment on: Palaver Idle Random Chat

I was chatting with the author a few minutes ago...

Stranger: this thing pretty much went global last night

Stranger: i was talking to people from all over the world

You: Have you posted this to Voat yet?

Stranger: no, never heard of voat

Stranger: you can if you want

You: It's a "Reddit alternative". After the fubar with Pao the other week, a lot of people have been leaving Reddit for Voat.

You: internet drama

You: and all that

Stranger: heh, the shift has begun

[...]

Stranger: post away if you feel like it

Stranger: i'd like to see how many users i can get

1 20 Jun 2015 17:24 u/Phen in v/programming
Palaver Idle Random Chat
2 1 comment 20 Jun 2015 17:20 u/Phen (..) in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.