Anand Athinarayanan

Ranch Hand
+ Follow
since May 20, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
15
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anand Athinarayanan

Understood. Makes sense to make it easy to test. Thank you for your help. Much appreciated.
Thank you so much. These are very helpful. The separate JARs are something new to me. so would the build scripts have to be tweaked to have the correct jars on the classpath ?
Hello,
My co-worker and I have been having some conversations about an implementation and could use some help.
I have a class called RulesEvaluator which has some business logic. This class needs some reference data which is available in another class called ReferenceDataHelp. (The ReferenceDataHelp gets the data from a database if it matters).

So now I have the caller code which instantiates the RulesEvaluator and calls a method called runRules on it. All good so far ! Now my question is how should ReferenceDataHelp class be thought of ? I'm thinking it as an implementation detail that only the RulesEvaluator class needs to know and hence the object of ReferenceDataHelp should be instantiated from within the class or the method.
However my co-worker thinks, the ReferenceDataHelp should be instantiated by the caller code and dependency injected into RulesEvaluator to allow for unit testing.
Hello,
I'm learning Spring Boot and ReactJS and thought of building a simple web application to practice. The idea is to allow users to add Coupon Information and then get alerted (not decided how, but Email is a thought) when the coupon nears it's "To be Used by Date". This is just a hobby app for me to learn both the technologies. Most of the websites I have checked have the React App served from a NodeJS server and then for the backend it interacts with Spring Boot mostly through an API. The one tutorial I had with just Spring Boot and React (using Thymeleaf) here seems overly complicated as it references something called web-pack which I have no idea about.

So my question is how common is to have a NodeJS with React and a Spring Boot and is this even a good architecture for web applications? If not then is the architecture in the tutorial (link above) more common?
I have only worked with one front end and one back end server/service so far in my career.
Yes I think ZG was right. In my mind I think of this like a utility type of method which can stand alone and can operate on the given input. I also think this is like some of the Apache IO Utils library most of which are static.
Would love to hear your opinion.
8 months ago

Zachary Griggs wrote:Lots of good solutions here!

Personally I made the method static because if I had to use this in my project, I would create some sort of StringHelper or StringUtility class that does not get instantiated. The method itself doesn't need any sort of state to operate correctly. Though this is very much open for debate; I don't think there's a "correct" answer here so I'd be interested in hearing other perspectives.

I believe you could also do a toSet() call, rather than the .distinct().toList(). Though that works completely fine as well.



I found this thread from the code ranch October journal and I came here to respond the exact same thing. I saw some one ask the OP an opinion on why Zachary Griggs made the method static.
8 months ago
This is great Ken. Definitely much more robust and testable. I will give it a spin and get in touch if anything is not working. I'm beginning to like Python already
8 months ago
I appreciate the offer Ken. So here is what I have so far. Won't be able to post the actual code but it's close to it. I'm using python 3.7.1



Initial tests show it is working fine but just seems very slow. I think it might be because the orderDetailsData file is on a network storage and I need to access it each time which Unfortunately I cannot copy to my machine because of "restrictions" . But what do you think and is there a better or Python way of doing it.

Have to say this, coming from a Java background I find the python libraries very useful but at the same time I couldn't think in Python yet. Keep going back to OO and SOLID principles.
8 months ago
Thanks Ken. I might have misquoted my problem. It is not a specific pattern. It's a list of unique text running into one thousand atleast . The text is a combination of alphabet and numbers example would be - XY18736272. This is the source file.
And then I have few hundred files, each file running into thousand or more lines. In some of these lines the text XY18736272 would be embedded. If I find it I need to extract the full line containing it and write to another file.
One advantage is the hundred odd files are comma separated files so I know exactly which position to look for.
At this time I have been able to just start with file reading part.
I will look at your examples also. I see there is a free preview of your book in the site. Thanks
8 months ago
Thank you for your responses. I have always wanted to learn a different language other than Java but never just got around to do it. Python seems different but interesting. At my work recently I had to read a bunch of files and look for specific patterns from a different file and extract the entire line matching the pattern . I'm thinking of trying it out in Python. I was able to get my request for the software approved. This is not part of my project work but just a side work that we normally use excel for. Let's see how this goes.
I'm a bit on the slower side of learning but persistent learner.
8 months ago
Hello,
I'm a Java/Gosu developer mostly working in enterprise wide web application. Recently I have seen more traction in the world of python and a lot of it revolves around machine learning. I have no background in Data science . I don't even have a CS degree from college for the matter. So I'm wondering is python a good language to learn for improving job prospects and career for someone with a Java web background and not wanting to move to data science world now.

Thanks
8 months ago
Tim : Thank you. By API I mean a library. Regex always has been confusing for me but I understand for text manipulations Regex is powerful. I like it when there is less code.

Campbell : Whoa, that's some good advice. Thank you. I'm checking the link you provided. I have to go back to my notebook now.
3 years ago
I'm working on a problem of stripping NON ASCII data from an input string ,replace it with whitespace  and return the ASCII data. There are probably libraries which do it already but i'm getting back to honing my java skills so i wrote code for that. And then it got me thinking, if i were to expose this as an API what else should i do ? Put it another way do we have a blue print for writing code that makes it API ready.

What are some improvements that i should make when writing code for such problems which are common and what type of tests are run usually ?

3 years ago
It feels great to read through all the replies in this post.

@ Michael D Sims - Using Regex came to my mind after I came out of the interview room.

Update - I didn't get the job but I did learn quite a lot from this thread and I'm happy to realize i have a lot to learn and a long way to go. Thank you everyone for your thoughts !
6 years ago
@Junilu Lacar - Exactly !

@Joe Harry - Thanks. Never Struck me at that moment but again it would have been no use anyway. No body is going to do that in any kind of job.

@ Maneesh -Wish , I could have answered like that
6 years ago