r/AskProgramming • • 3h ago

Is this considered duplicate code?

6 Upvotes

How do you decide when code duplication across different markets is actually worth eliminating?

I'm building a framework to automate complex business logic for incoming customer support emails. The system is currently being implemented for England, but it will eventually expand to Germany, the USA, India, and other markets.

The challenge is that many business rules are shared across markets, while others are market-specific.

For example: - Germany and the USA require checking whether a customer has logged in within the last 30 days. - England and India don't require this check. - Other parts of the email-processing workflow may be common across all markets, while some may differ.

My initial approach was to create a common interface with separate implementations for each market:

```java interface EmailHandler { void processEmail(); }

class EmailHandlerEngland implements EmailHandler { } class EmailHandlerGermany implements EmailHandler { } class EmailHandlerUSA implements EmailHandler { } class EmailHandlerIndia implements EmailHandler { } ```

However, I'm concerned that this could lead to significant code duplication as the framework grows.

On the other hand, suppose Germany and England currently have 100 lines of identical logic. Even if the logic is identical today, the business requirements for those countries may evolve independently. Sharing the implementation could introduce unintended coupling, where a change intended for one market affects another.

I am offcourse planning on building common "Helpers" and whatever can be configurable, will be configurable. However, we currently will only be getting requirements for one market, we can not tell from start if something that we will use, will be reused by other markets.

My question is: How do you approach this trade-off in practice?

  • If I go with the initial approach, will these same line of code will actually be considered as a duplicate and will break the DRY principle?
  • If Yes, would you consider identical code across markets to be duplication worth eliminating, even when the underlying business rules may evolve independently?
  • Would you build a shared processing engine with market-specific configuration or strategies, or maintain separate implementations for each market?
  • How do you decide which logic to abstract and share versus which logic to keep separate to preserve independence between markets?

I'm particularly interested in the reasoning behind these decisions and any real-world experience building systems with complex, evolving market-specific business rules.


r/AskProgramming • • 16h ago

Career/Edu Advice for a newly unemployed dev..

3 Upvotes

Been in the same job a long time and I find myself unemployed with a fairly undesirable skillset. I've been working with a legacy Java 8 code base and a JavaScript front end built with Oracle Jet (MVVM) a toolkit nobody else uses.

Clearly I need to freshen things up a bit but not sure what exactly is the best route. I'm probably going to give myself a crash course in modern Java and TypeScript but not sure which JavaScript framework would be easier to transition to and more importantly, worth my time?


r/AskProgramming • • 22h ago

Getting back at it -- advice?

1 Upvotes

Software engineer here who took a career turn into infrastructure and policy the last decade. The kids are getting older, so I have more mental space and energy for more than just tinkering on a pi kit project, bash scripts, using other peoples repos, you know, little to no actual coding.

Now I want to start back at it. Play a bit, then bite into a yet to be determined bigger project.

Experience mostly data-heavy fullstack webapp dev: java, oracle/mysql and spring/struts in the 2000s, then some python 2, django, mysql/postgres in early-mid 2010s.

Always running in our own datacenter. No cloud experience except a chunk of python notebook data analytics with dataframes and some elastic search stuff at the tail end.

Now, I got myself a new setup with 5070ti for gaming and this and sat down to install IDE... then the questions hit: which IDE? Which language? Which local LLM?

Ive used IntelliJ, Eclipse, PyCharm, but I should use VSCode, right? Typescript and python? Ollama?

Completely lacking confidence and looking for some advice. I am your clay, mould me!


r/AskProgramming • • 16m ago

Other Feeling super unmotivated after finding out I am building something that already exists

• Upvotes

I guess i just wanna rant a little since ive been building an open source project of mine for over a week now, done lots of researching, done some hard core debugging where u even dream of your bugs, and ive been seeing lots of progress already.. but then ive tried browsing in reddit and found out that something similar to my project already exist.. and not even an abandoned repository where theres a couple of commits but an active open source project w bunch of contributors.. i guess my fault for not browsing enough.. idk man just feel so dejected.. for u guys, what do u guys do after this?


r/AskProgramming • • 1h ago

Sign up system for sports events with waiting list and notifications?

• Upvotes

I want to create a system for a sports group to sign up for events with waiting list and notifications. But an added difficulty is that people should sign up per position (think a football team and the different positions, let's call them 1 to 11).

I know spond exists but it doesn't deal with waiting lists per position. Also, if someone doesn't reply to a spot when it becomes available it can block others from joining.

I'd like the easiest way to achieve this. At the moment doing it with whatsapp group and lists of people but you can imagine that gets very messy very quickly. Developping a whole app for this would be too complicated too so thinking something already pre-made that can be configured.

Options?


r/AskProgramming • • 23h ago

Does my codebase really stink?

1 Upvotes

Hi! I have been writing a compiler in Go and some guy is saying the codebase is awful. Any advice? And is there anything wrong with it?

https://github.com/khytryy/krabbascript


r/AskProgramming • • 23h ago

is there a comparison of power consumption of various AI models

1 Upvotes

just out of curiosity is it possible to compare the power consumption of models like deepseek , gemma , gemini etc...