greptilian logo

IRC log for #friendlyjava, 2017-09-29

##friendlyjava on freenode

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

All times shown according to UTC.

Time S Nick Message
02:16 anaderi joined ##friendlyjava
02:16 anaderi hi
02:17 aditsu anaderi: hi
02:17 anaderi u do JavaFX?
02:17 anaderi or GUI programming
02:17 aditsu sometimes
02:18 anaderi what frameworks do you use
02:18 aditsu for GUI? I used to use Swing; more recently JavaFX
02:19 anaderi oh, have you become familiar with the JavaFX APIs?
02:19 aditsu a little bit
02:19 anaderi I find that they dont scale for bigger apps
02:19 anaderi For example, I was previously using dependency injection for everything
02:20 anaderi Since JavaFX doesnt provide it out of the box
02:20 anaderi But then I created this class called ViewController
02:21 anaderi which is a paradigm I learned from iOS programming, and the code become pretty clean
02:21 anaderi Dependency injection is kind of a problem because while people say it makes testing easier, I kinda disagree but that's a pretty big topic
02:22 anaderi But the ViewController caused some slight problems that dependency injection solved
02:22 anaderi So I'm trying to find the right balance there
02:23 anaderi (Btw, the ViewController class is subclassed in *MOST* controllers)
02:25 aditsu I'm not sure how I can help..
02:25 anaderi I was wondering if you encountered the same problems with Swing
02:26 aditsu I haven't written any ViewController, and haven't done much DI
02:26 anaderi why not, what did u use instead
02:27 aditsu instead of what?
02:32 anaderi talking between various components
02:33 aditsu um.. some of my components talk to each other
02:33 anaderi ok how did u do that
02:33 anaderi u cant instantiate those components directly
02:33 anaderi sometimes you can, sometimes u cant
02:34 aditsu by passing references, mostly at construction; I guess that counts as a "natural" way of doing DI?
02:34 anaderi so you passed references in your contructors?
02:35 aditsu in some cases, yes
02:35 anaderi how did that go for you in testing
02:35 aditsu fine, I ran the program and tested it :)
02:36 anaderi but don't your components have references to buttons, textfields, etc?
02:36 aditsu um.. yes, some of them
02:37 anaderi but you are only passing references to other components in the constructor?
02:38 anaderi How will the references to your buttons be fulfilled?
02:38 aditsu well, if I create a "child" component, I pass the parent in the constructor, and the parent may keep references to children in the class fields
02:39 anaderi but what if your "child" has buttons
02:39 anaderi they parent doesnt have references to the child's buttons
02:40 aditsu not sure why it would need references, but if really needed, I could obtain them from the child
02:41 anaderi ok let's say u want to test this "child"
02:41 anaderi it has a constructor with the parent
02:41 anaderi how are you going to test that
02:41 aditsu I usually test the whole program
02:42 anaderi not the individual classes?
02:42 aditsu I may test certain relevant features when running the program
02:43 aditsu features implemented in those classes
02:43 anaderi but you don't directly test your controllers, right?
02:43 aditsu depends what you mean by "directly"
02:44 anaderi like having a 1-1 relationship between a test class and a controller
02:44 aditsu are you talking about isolated unit tests?
02:44 anaderi yeah
02:44 anaderi and you are talking about functional tests?
02:44 aditsu I don't do that for GUI stuff
02:44 anaderi Therein lies the problem I am trying to solve
02:44 anaderi unit testing GUI apps
02:45 anaderi not sure if it is reasonable
02:45 aditsu pdurbin, pulsar: do you guys have any thoughts on this?
02:46 aditsu I'm not that "big on" unit testing
02:46 anaderi The thing is, I just noticed functional tests break every time the app changes
02:46 anaderi It's one of the costs of functional tests
02:47 anaderi And I've done unit tests before, they break less often
02:47 anaderi I've found that if you unit test the expected "API" of certain classes, your unit tests rarely break
02:48 anaderi But functional tests include the UI components themselves, which is not exactly the "API"
02:48 aditsu I suppose you could write some mock classes.. but it can get hairy
02:49 anaderi Perhaps the problem is that controllers don't really have an API?
02:49 anaderi I guess sometimes they do
02:49 anaderi And you can assert on their UI objects
02:50 anaderi So their API could be something like replaceOrAddTab(Tab tab)
02:51 anaderi And you can assert with getTabPane.getTabs()
02:51 anaderi But looking at my code, the majority of the time there is no API
02:57 aditsu you can also check what others have to say: https://www.google.com.hk/search?q=unit+testing+gui
02:59 anaderi Thanks, so far from reading the impression I am getting is to not test the controllers, only the "model"
03:00 aditsu yeah, what you really want to test is the business logic, which should be separate
03:03 anaderi idk man, looking at my code there's a lot more UI logic than business logic
03:04 anaderi But the question is, does it make sense to test UI logic
03:05 aditsu it might.. it depends on the application I guess, and it's not very easy to do
03:06 aditsu btw, there are automated test tools for GUIs, they can click on buttons, type stuff, verify that it displays a certain thing, etc.
03:07 anaderi_ joined ##friendlyjava
03:07 anaderi_ got disconnected, did you say something?
03:07 aditsu you can check the logs from the topic
03:21 anaderi_ What's the command? Tried googling it but nothing came up
03:22 aditsu um no, the channel has a topic that you should be able to see (a bunch of text beginning with "Be friendly")
03:22 aditsu it includes a link to the logs
03:22 aditsu but I can give it to you here - http://irclog.greptilian.com/friendlyjava/today
03:23 anaderi_ ok thx
03:24 aditsu if you want to use a command, try /topic
03:27 pdurbin I assume unit testing GUIs is difficult. I haven't done it myself.
03:28 anaderi_ how do I get the arguments for a command? /help topic didnt work
03:30 aditsu you can find some info at https://en.wikipedia.org/wiki/List_of_Internet_Relay_Chat_commands#TOPIC
03:31 aditsu though those might be the actual protocol commands..
03:32 aditsu anyway, you can run it with no arguments to see the channel's topic
03:34 aditsu pdurbin: that's what I suspected..
03:36 aditsu anyway, I gotta get some sleep, see ya
03:37 anaderi_ cya
03:37 anaderi_ not a channel operator :P
03:38 anaderi_ that's the message when I used /topic
06:32 mr_lou joined ##friendlyjava
06:42 abba joined ##friendlyjava
06:43 anaderi_ hi
09:12 elcmat joined ##friendlyjava
09:13 pulsar aditsu: it has been over 15 years i did some java swing stuff, and back then we did not gave s**** about end-to-end testing :)
09:16 pulsar nowerdays tools like jasmine and protractor are defacto standard to do e2e ui testing. web technology based ui that is.
09:18 pulsar and in my personal opinion: javafx is not going anywhere. it does not seem to pick up any momentum since years
09:19 pulsar and everybody else and their grandmother is doing electron shell / javascript for gui apps.
09:20 pulsar which funnily waste a lot of more resources than an average java fx/swing app would do.
09:22 pulsar and suddenly all the js hipsters stop bitching and moaning about java memory & resource requirements when i mention the electron madness. peculiar. :D
09:42 elcmat joined ##friendlyjava
10:40 elcmat joined ##friendlyjava
10:40 elcmat joined ##friendlyjava
10:55 aditsu elcmat: you get a message about not being an op if you try to change the topic
10:55 elcmat aditsu ?
10:55 aditsu elcmat: sorry, wrong person
10:55 aditsu was meant for anaderi.. who is not here anymore
10:58 aditsu pulsar: electron is an abomination, and it needs to die
10:59 aditsu but yeah, java seems to get a bad rap, especially for the desktop..
11:01 aditsu which is too bad, because JavaFX is actually kinda nice, once you overcome the bugs
11:29 elcmat ho
11:30 elcmat i have quit java for now
11:55 elcmat_ joined ##friendlyjava
11:59 elcmat_ left ##friendlyjava
15:03 df0_ joined ##friendlyjava
16:10 aditsu joined ##friendlyjava
18:23 anaderi joined ##friendlyjava

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

##friendlyjava on freenode