|
Sorry if this is a bit late. The way I look at DFS versus BFS is the type of data structure that you use to store intermediate nodes to be processed. DFS tends to get written as an explicitly recursive algorithm but you can remove the call stack and replace it with an explicit stack in code iterated over with a loop. BFS doesn't have a nice recursive way to write it out (probably something involving coroutines though) but can be written as an iterative loop with a queue. At this point it's worth mentioning a fun little data structure called the deque that can be a stack or a queue at the same time. A search written with a deque therefore can do either BFS or DFS with remarkably little modification. code:
code:
|
# ¿ Jan 5, 2021 03:19 |
|
|
# ¿ May 12, 2024 09:28 |
|
I think that Effective Java by Joshua Bloch is probably one of the best books in terms of understanding specific Java issues. The same author also wrote Java Puzzlers which cover subtle gotchas. Otherwise for general "Is this good Java?" advice, idiomatic Java doesn't really value terseness and if that thousand line for statement is mostly Spring bullshit, hopefully some day it'll just blend into the background.
|
# ¿ Jan 6, 2021 01:14 |
|
Also you can use import static Card.Suit.* to just import the card suits directly like you want.
|
# ¿ Feb 10, 2021 19:41 |
|
F_Shit_Fitzgerald posted:Is it better than Eclipse? I've been using that because it was the Java IDE my university recommended. I've heard good things about IntelliJ, though. You can't control a Mars rover with it like Eclipse has been used for but professional developers tend to like IDEA more for its smart autocomplete, whole-project indexing and other features.
|
# ¿ Feb 10, 2021 21:39 |
|
As far as Java GUIs go, Swing has been updated somewhat so that some of its classes use generics and single method interfaces. That's actually a nice feature that makes it a little bit more nice to use but is long after Java's heyday on the desktop. As far as using it goes, I'm not a big fan of GUI builders and suggest writing well-structured code to actually organize stuff rather than one big autogenerated block. Something that makes a difference is that there's default models that can be used to back GUI objects but they are mainly useful for demos and other stuff where you don't have real data. Making your own implementations of those interfaces that directly reference your data are much, much easier than trying to cobble together some other classes that manipulate your real data to match the model object.
|
# ¿ May 1, 2021 03:02 |
|
|
# ¿ May 12, 2024 09:28 |
|
It's not exactly GUI but if you want another sort-of GUI framework that's Java-based look at GWT or Google Web Toolkit. Like all great Google projects it's technologically mindboggling in some ways (at least for the time) and no longer supported by the company. It's making a UI in Java with most everything working the same as on desktop, but then transpiled into optimized javascript and run in the browser. It's very good at making single-page apps but can also do multi-page webapps. edit: I'm also a big GUI nostalgia fan.
|
# ¿ May 1, 2021 03:27 |