• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database comparison and merging with user confirmation

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I was recently brought in to my first programming company/job. I was placed on a project that already had code written by someone who has never been a programmer and it didn't work. Rather than troubleshoot the poorly organized and written code I asked if I could rewrite the code from scratch. Here is where the issues come in, I am a relatively well versed programmer, but my expertise lies in .NET. Unfortunately for me, the client made specific strict requirement that the code be an open source platform. I have found that JAVA will be the best platform for me, but I have little experience in it. What I need to be able to do is compare 2 tables from different databases. The first database is a list of clients and their personal information like addresses, etc. the second database should have the same information, but when the client updates information they only update it in database 2. I need a nightly reconciliation that compares all information, and updates database 1 with the new or updated information from database 2. It seems simple in my head but my head thinks in c# rather than java. The kicker is, the program has to ask the user for confirmation before it submits changes. Sorry for the long post, I just need a place to start.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Given your background is in C#, so picking up Java shouldn't be that hard.

Now for your problem. If the task is done in C# how would you do? What classes or entities do you need? Since in Java there is something called equals() method and hashcode() method which is probably what you want to do your comparison.

And for your user confirmation ... what kind? Web based, GUI, or console?

I will let you figure out the coding.
 
Harry Meade
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply K. Tsang. As of today, however the client has again changed his mind and requested the code be written in python, so I'm back to the books.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again. Why is the customer specifying the language you use?
 
Harry Meade
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm honestly not 100% sure, honestly. I got hired into a small company and took over a project. What I've been told is the original programmer is actually not even a programmer. He is a super-genius level geophysicist, or something similar, and he picked up python and wrote this code. The problem is, that he is autistic as well, so his code is VERY VERY hard to decipher. There is a lot of code for simple processes, it is not organised in any way, where there should be only 2-3 classes there are 8 or 9, it is very blocky and inconsistent, one piece of code is pulling from 2 or 3 other files and I can't even begin to figure out what's going on in each. He specified very very strictly that the program needs to be open-source, then further that it need to be in python. Maybe because it is for a non-profit company, maybe because he thinks down the road he will have to work with it again and only knows python, maybe just because he wants it that way. I don't get to meet with him for the first time until Wednesday to figure out what is going on. I know one database is built in etapestry, which makes things very difficult.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good grief!
The only thing that sounds good is that there are lots of classes. It is much easier to use lots of small classes even if you decide to merge them, than to use few large classes and try to split them.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As K Tsang said, C# and Java are very similar. That can cause problems; I saw somebody who came from C# to Java have problems with the == operator. It is overloaded in C#, but not in Java, so in C#…tests whether the contents of s and s2 are the same.
Such code worked in his Java work because all the Strings were loaded from literals, until he serialised something, closed and reopened the app. Now all the de-serialised Strings were different instances from the literals, so all the == tests failed miserably.

Winston, your turn to link to the FAQ.
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Harry Meade wrote:Maybe because it is for a non-profit company, maybe because he thinks down the road he will have to work with it again and only knows python, maybe just because he wants it that way.



I bet they only know python... or python is the language their internal programmers knows the best.

Yet it's not themselves trying to fix it in the first place is probably, they don't know what the last person did so hire you instead.
 
reply
    Bookmark Topic Watch Topic
  • New Topic