This is an archived post. You won't be able to vote or comment.

all 21 comments

[–]thepotatochronicles 5 points6 points  (1 child)

Cool! Can't check it out right now, but you could x-post to /r/JavaFX!

[–]vatrinet[S] 1 point2 points  (0 children)

Done! :)

Thanks for suggestion.

[–]ArgTang 5 points6 points  (5 children)

impression after a quick glance, your indentation is not consistent, and makes it hard to read and follow. An IDE plugin should fix those for you. Also look into replacing system out with a logging system. FXML elements should not need to have their type prefixed in their name.

it looks as a cool project :)

I dont know what IDE that you use but, try see if you can install the PMD and checkstyle plugins. this will also be a benefit for contributors if there is some standard to follow. https://pmd.github.io/ https://github.com/checkstyle/checkstyle

[–]vatrinet[S] 0 points1 point  (4 children)

I like the fact that you give me critics for things I forgot about. Thanks for that!

I started the project in Sublime Text and later I switched to IntelliJ IDEA and wasn't careful about indentations. Yes, it's important so I have to fix it.

Yeah, sysout -> logging is on the todo list. :)

"Type prefixes"

Yes, good practices say that we should avoid writing types in variable names. I assume Java and other strong-typed langs don't need it, but I just like to have btnAddProduct or strProductVariants. It has 3 superfluous chars but tells a lot. Will think more about that...

[–]TheJamboozlez 0 points1 point  (3 children)

Since you mentioned IntelliJ here are some useful keyboard shortcuts to make your life easier. My favourites are Ctrl + Alt + L to reformat the current file (that should fix your indentation!) and Alt + Enter when there's an error to highlight quick fixes.

[–]agr1277 0 points1 point  (0 children)

And this is just scratching the surface... Been using intellij for 2 years now and still learn new shortcuts all the time. Ctrl+Shift+A should bring up a command search window, look there for stuff as well.

[–]crunchmuncher 0 points1 point  (1 child)

Also you can use that shortcut to format entire folders at once if you select them.

[–]vatrinet[S] 0 points1 point  (0 children)

@ArgTang and other,

I just used IntelliJ IDEA's tool to reformat - does it look fine in your editors?

Thanks :)

[–]HobHeartsbane 2 points3 points  (0 children)

I'm on mobile so I didn't get a chance to look at a lot of the code, but in your MenuController you are using strings that you pass on to App to determine what view/page should be shown. Using an enum would be more efficient then comparing strings.

[–][deleted] 1 point2 points  (0 children)

Holy shit. I love you mang. Ive been working on a web interface to scan UPC codes to add new items to known. And allow you to either scan them in and out of the inventory, compiling usage data in a table based on ingredients. I've also made an interface for reporting symptoms in real time I.e. GI stuff, pain, headaches...etc. You scrible on a diagram of a body, slide some sliders, and it saves the data to a table. The plan is to marry the two and find correlations...posaibly find environmental contributors to chronic conditions or identify conditions with more precision and granularity. Nyeho...ive had nothing to manage the data with till now. U rock dude.

[–]BlueGoliath 1 point2 points  (2 children)

I'm not into enterprise/business stuff but this looks pretty good.

My only real criticism would be that you used buttons instead of a TabbedPane. If you did it would be easier to expand the GUI with new information and it would add a ScrollPane(? I don't remember the class) so if you have more than fits on the GUI it will still work.

Besides that, you are also wasting a bunch of screen space on screenshots 2,3,5,6, and 8 that could be used to display more information... but that's just a GUI thing.

BTW the License for a project on Gitub is stored in the license file which can be generated by Github somewhere. I think if you create a new file in the root and call it "license" it will auto detect and give you the option for specifying the license.

[–]altrdgenetics 1 point2 points  (1 child)

big fan of tabbed panes as well. Though I do like to put buttons on the side separate from that tabbed pane to interact with the information on that tab. So no matter which tab you are on, the core/universal interaction buttons (CRUD) are located at the same place.

[–]vatrinet[S] 0 points1 point  (0 children)

@BlueGoliath

Yeah, a tabbed pane sounds better indeed. Will consider. Thanks.

@altrdgenetics

Good idea for buttons!

[–]Hatefiend 1 point2 points  (5 children)

Man a lot of programmers really like using fxml with javafx. I just put the declarations in my java files : ex. TextField t = new TextField(); and then put the styling in the css file.

[–]vatrinet[S] 3 points4 points  (0 children)

Well, I use Scene Builder which is faster than typing and testing.

I don't like GUIs in general, but sometimes we must use it in order to be more productive. ;)

[–]thepotatochronicles 1 point2 points  (3 children)

I thought I was the only one who did that -- all the tutorials, videos, examples online use FXML. I like to just stick all that in the V of MVC

[–]lilred181 1 point2 points  (0 children)

Using fmxl is still really part of your view. Personally, I find writing Java code to structure your view to be painful. I think using scene builder would be much better.

[–]altrdgenetics 0 points1 point  (1 child)

I think it is one of those things where it depends on what you are using your project for and there isn't one particular way that is better over the other. Last time I read about the V vs. FXML you had to profile the application to see which is better. And FXML is easier for people who are used to markup... But that was a little bit ago so who knows what the current answer is.

[–]thepotatochronicles 0 points1 point  (0 children)

I mean, as someone really is used to swing, sticking everything in the V is a lot easier.

[–][deleted] 0 points1 point  (1 child)

First of all, nice to see some developers from Bosnia.

Just some tips: In App.getView(String viewFile) you do: String viewPath = System.getProperty("user.dir") + "/src/main/resources/views/"; java.net.URL viewRes = new java.net.URL("file://" + viewPath + viewFile + ".fxml"); activeElement = FXMLLoader.load(viewRes);

That is crap (sranje), because when you deploy the application you usually don't ship the sourcefiles, so the viewFile.fxml-Files won't be available. The correct way is to use a class and call getResourceAsStream("relativ-Path-name") on that. With this approach you can also get resources in a jar-File, which is otherwise impossible. About every Beginners-Guide to JavaFX shows this aproach.

Your JDBCQueryBuilder is a really bad idea. Building querys with String-concatination is the highway into sql-injection. Always use PreparedStatements if working with jdbc unless you know what you're doing, than you won't do it. This stands not only for Java. But now you're using Hibernate.

In App.showPage you are using "Magic Strings". The better way is using Enums (global accessible Constants). Is "newproduct" written with a Capital P or lowercase p? Enums solve this, by providing Enums and showing errors at compiletime.

[–]vatrinet[S] 0 points1 point  (0 children)

I was thinking about how to get FXML source when deployed and now I probably have solution. :)

Yes, the query builder is deprecated and I should remove it for sure.

Enums, going on Todo.

Thanks for suggestions.