Reputation
292
Top tag
Next privilege 300 Rep.
Create new tags
Badges
3 9
Newest
 Commentator
Impact
~11k people reached

  • 0 posts edited
  • 0 helpful flags
  • 18 votes cast
Jun
28
awarded  Commentator
Jun
28
comment Should you write your back-end as an API?
Interestingly, I see this entire argument as very analogous to OO encapsulation, but at much larger abstraction level. Kind of like OO newbies questioning whether or not it is ok to skip getters and setters for "simple classes." The truth is that yes it is ok, but only in legitimately simple situations, which is something like a private inner class that takes 30 seconds to write. IMO anything as complex as a client and server is time-consuming enough to write that it should embrace encapsulation, i.e. an API.
May
5
awarded  Popular Question
Feb
23
comment How to respond to a rude bug report?
@Lilienthal the happy/right question is the best way to prevent spousal arguments. ;-)
Dec
25
comment Is every language written in C?
See my similar question here. I highly suggest reading the book I mention in the beginning of that question, as it would get you way beyond the confusion in your question.
Nov
9
awarded  Good Question
Sep
24
awarded  Autobiographer
Feb
22
awarded  Notable Question
Jan
13
accepted Thoughts on a custom data structure for a node/chain implementation
Jan
13
comment Thoughts on a custom data structure for a node/chain implementation
No worries. I did some profiling (which probably wasn't 100% accurate), but with the problem sizes I was using it actually showed arraylists being 5-8 times faster than linkedlists... a big difference as you alluded to in the comments higher up. That was definitely news to me, but cache locality does indeed sound like maybe one good explanation.
Jan
13
comment Thoughts on a custom data structure for a node/chain implementation
Yeah, I ended up just going with an arraylist anyway, especially since as I noted in comments below, I have to go through my collection linearly to paint it all on screen anyway. Thanks for your thoughts though. :-)
Jan
12
comment Thoughts on a custom data structure for a node/chain implementation
@sparkleshy Thank you for capitulating to dude's demands. The annoying verbosity was helpful. Another thing which I didn't even think of - as you say, all the the elements will be on screen... which means no matter how I represent them I will already have an O(n) operation when I draw them all on a screen repaint!
Jan
12
comment Thoughts on a custom data structure for a node/chain implementation
Thanks. That seems like a reasonable suggestion. But it still bothers me that with this design, when a waypoint is chosen in the UI, even if we know without a doubt which route it belongs to, the route still will need to walk through its entire linked list from the beginning until it locates this waypoint so that it can insert something before it (please correct me if any of that is wrong). In my solution the waypoint itself (rather than the list) keeps track of its neighbors, so you never have to do O(N) search on a list. Maybe I'm just stubborn, but I'm still tempted to try it this way.
Jan
12
awarded  Editor
Jan
12
revised Thoughts on a custom data structure for a node/chain implementation
deleted 6 characters in body
Jan
12
comment Thoughts on a custom data structure for a node/chain implementation
Good point, 2 * O(n) is still O(n). I don't know enough about the specifics of a Java linkedlist or arraylist to know that one would surely be faster or slower, come to think of it. I edited the OP to reflect that.
Jan
12
comment Thoughts on a custom data structure for a node/chain implementation
Yeah, I (the OP) would be curious as well. I can sort of see how circular references can create problems, but I'd think if you design each class well enough you could avoid those problems (i.e. make sure that for every possible way to mutate one class, the other automatically updates to reflect it). I also will admit an ArrayList would probably be fine because it's not like these chains are going to be millions of elements long. But it still irks me to choose an implementation which is less than the most efficient.
Jan
12
asked Thoughts on a custom data structure for a node/chain implementation
Dec
26
awarded  Yearling
Feb
13
awarded  Popular Question