Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Tom Joe

Ranch Foreman
+ Follow
since Aug 26, 2018
Tom likes ...
IntelliJ IDE Eclipse IDE Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Joe

Apparently, they are bad because JOINS are not really set operations, but are actually a cartesian product -
IMO, that might be technically correct. But, to me, the venn diagrams are easier to understand and remember compared to cross product diagrams. I don't know why venn feels easier though. Maybe because venn is the first thing I learned and got used to it, or maybe it is really easy because the diagrams are simple. IMO, what matters is whether something helps you to understand things easily and correctly. Does not matter if it is "technically incorrect".

What do you think ?

After getting a computer programming job, a guys asks "When are we going to get tickets/features for reversing strings, finding palindromes etc. " ?

PS - Many job interviews ask interviewees to solve such programming exercises, even though the job will actually be somewhat "simple" and won't involve developing new data structures or algorithms.
2 weeks ago

Mike Simmons wrote:Well, probably I would use

Thanks. I have never used that code before. But, I did manage to cobble together some working code from the internet. How does it look ?

I wonder if this code is still verbose due to my mistake, or if Java continues to be a verbose language even with all those new Files, Paths utilities.
1 month ago
Here is some Java code to rename all the files in a directory with sub-directories by replacing dashes in file names with spaces. I cobbled together that code from the internet. The code is not important, but I see that File is actually a general name for "file" and "folder"/"directory". Hence, a File can either have file or folders. This structure reminds me of the Composite iterator pattern which can iterate over tree like structures.

I know that File already has a listFiles() method that returns an array of File-s which can be iterated with a index loop or for each. But I was thinking if we should make a Composite iterator for File. Is this a good idea ? If yes, then I wonder why it is not already provided by Java. I don't want to keep writing recursive functions every time I want to do something with some/all the files in a folder.

1 month ago
Consider the use of the if block like this :

I think the use of not operator in this case just makes the if-condition a *little* bit harder to understand. Most coders are smart enough to understand it easily, but why make them think harder ? Why not put a simpler condition like this :

Does this make sense ? Assume that you have tests which check this if block.

1 month ago
Instructions to use :

Keeps the virus and ladies away.

PS - I don't know what any of that text in the image means. German ?
1 month ago
Updates again :

>>> Updates in other code :

SearchFilterWebPageAsJavaCode :

MainMethod :

Junilu Lacar wrote:
Ok, I think I see what you're trying to do and yes, the semantics are closer to what I would think of as a Command rather than a Predicate/Filter. However, the approach you show is totally backwards from what I would do. To tie this in to the other thread you started about TDD, this would be a perfect example of how TDD and the kind of thinking it develops coulda/woulda led you to a much better solution. If you're up for it, I can show you how I would do it, TDD style.

Thanks, but can we do it next week when you have time ? Right now, I have some stuff coming up which will take most of my time. Actually, I should not even be working on this post now, but I could not resist.

I sort of used TDD here. I wrote what the interface should look like and built the code accordingly. I wonder if it would be better to pick a new problem instead of this one for TDD, since I have a (ok ?) solution and hindsight might mess the TDD approach.

Junilu Lacar wrote:First of all, if you really going to target Selenium, then learn about the Page Object pattern in Selenium. This will save you a lot of time and effort (and pain) if you start using this pattern in your tests.

Yes, I am actually using Page objects in the actual code. I have not shown it in this code so that those who don't know Selenium can still understand the code and help. Plus, we don't get bogged down with selenium and the slow browser runs.
Updates again to previous code.

Main method :

Output :

Support :

Does it help if we replace Procedure with

and then replace mentions of Procedure in the main method with Procedure<SearchFilterWebPageAsJavaCode> ?
Here are the updates to my code. I think a "Procedure" makes more sense here instead of Function, Predicate or such. It is just like a Command with execute method. Maybe we should call it that instead of Procedure.

Procedure :

Main method :

Output :

NOTE - We'd like to have a "set" of filters to reuse in our code. The next step is to make that possible by moving the filter storage logic out of the Page class.
Thanks for the detailed reply Junilu. I think I oversimplified my code example for brevity. I apologize for any confusion this created in understanding the problem. Here is a better representation of how it works. Meanwhile, I am trying to see if and how I could apply predicates to the below code.

Main method :

Output :

Supporting code :

Stephan van Hulst wrote:If Junilu's attempts to teach people TDD on these boards can't be called dedicated, then I don't know what can.

Maybe you mean live, in person coaching?

I did not know that he was dedicated to helping people out with TDD here. Yes, I meant live, but remote coaching (regardless of covid).
1 month ago

Stephan van Hulst wrote:
Not all is so bleak. As Junilu said, there are many skilled programmers on this forum that gladly use TDD and will talk your ears off if you let them. Expecting people to provide you free resources however, comes off as slightly spoiled.

I wish they would provide a few (not 1 or 2, maybe 5+) video examples of TDD for free for the entire world to advertise TDD. Then, people can try (enough) before they buy and it will also make a (stronger) case for TDD. I understand how this comes off as being spoiled. But, I have spent a bit of money on educational resources and will continue to do so. I wish I could get some free or nominally priced demos to see how TDD really helps before I spend several hundreds or thousands of dollars on bigger courses. I do realize that a few 100 or 1000 dollars for a great course are pennies compared to what one can earn with the knowledge from that course.
1 month ago

Junilu Lacar wrote:

Is there any list of "good" TDD practitioners who can do one on one coaching or small group sessions for a "reasonable" fee ?

I don't know of such a list except for maybe the list I keep in my head based on what I've seen and read over the years. But now I feel a little slighted . Maybe you didn't see my offer to help you in these forums as we've done with others in the past?

No offence If such a list existed, then couldn't you be in it too ? I prefer more "dedicated" coaching and that is why I asked for paid coaching also.

1 month ago