Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

What is a good modern language to use for a Business Rules project?

+9
−0

This is a rather vague question, but I'm trying to solve a specific problem and I'm inexperienced in most of the potential solutions, so please forgive the inherent ambiguity.

I have access to a database with millions of historical financial transactions, with new transactions being added every day. Based on these transactions I want to apply several hundreds of business rules. These could be things like, "apply sales tax per lookup table based on city and state," or "record commissions based on the internal salesperson and their commission rate." It could also include things like, "bill client X twice per month between April and October at rate R1 for type A transactions and rate R2 for type B transactions, and a flat $100 per month from November to March."

Eventually I'd like for the business rules to be programmable via a web interface, but that's unnecessary at the beginning. My main concern is creating a system that is reliable and flexible enough to handle this level of complexity while still being relatively maintainable and comprehensible.

Unfortunately, it seems that COBOL is one of the most popular languages for this kind of problem, but I'd rather not go that route. I've used R and SQL at much smaller scale in a similar problem space, but it wasn't ideal. I'm familiar in passing with BREs like Drools, but have never actually worked with them, and my general perception is that they are often difficult to maintain.

I don't mind learning a new stack for this project; Go, python, or Rust have all caught my eye in the past. But I keep wondering if I'm missing something that has more inherent support for this use case.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Programmable by whom? (4 comments)

3 answers

You are accessing this answer with a direct link, so it's being shown above all other answers regardless of its score. You can return to the normal view.

+2
−1

SQL is the right tool for this job.

  • You say the data is already in a database, probably a SQL database
  • You don't have to deal with moving the data out of the database and "into a programming language" as you would with others
  • This is an extremely common application of SQL, and you will find a plethora of relevant examples, guides and tools (including web based editors) online for it
  • Many SQL engines have sophisticated query optimization features that will automatically improve the performance of your queries while you focus on the result you want

You say your experience using SQL was not ideal. I'm baffled. There are billion dollar businesses that run on the premise that it is, in fact, ideal. Your examples sound to me like classic SQL exercises. I would recommend you take each example rule, and ask a separate question like: "How to apply sales tax per lookup table based on city and state in SQL?" By the way, for something like that, you will need to find a lookup table of taxes by location - that will often also be available as a SQL DB from third parties.

Note that you also mention recurring processes, like "twice per month". This is a scheduling problem and no language supports this out of the box. You will have to use a separate scheduler that will have its own peculiarities, to actually put tasks on a schedule. Some examples include cron (becoming obsolete), systemd timers, Airflow. Some database engines also have a concept of scheduled tasks/jobs.

For other languages you listed:

  • Python is probably the easiest after SQL. You will still have to deal with database I/O as a needless extra step, however some very complex rules may be easier than in SQL. It really depends on what rules exactly you need to implement. I said you should ask how to do each example in SQL, you should also ask for Python and compare the answer to decide what you'd rather deal with. Python is a very complex and sophisticated language, compared to SQL, don't be deceived by its apparent simplicity.
  • R will require some busywork to push/pull data from the database. The syntax for data manipulation will be a bit more complex and cumbersome than SQL in your case, with little benefit. The benefit of R is its extensive, correct implementations of statistical and data analysis formulae, and powerful plotting libraries. You are using neither of these and IMO it's not worth it for you to deal with its limitations.
  • Rust is a language designed to provide tight control over the low-level details of programs, like memory assignment. Its benefit is potentially better performance, and drawback is that high-level tasks require a lot more code and complexity to implement. I would consider it a terrible choice for what you want to do. Go is similar, although it is slightly less low level.
  • COBOL is ancient, it would be masochistic to attempt to use it in this century.
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

I think MySQL falls short of OP's core requirement to be reliable and maintainable. It needs to be po... (2 comments)
+8
−0

Caveat

When making a decision of such lasting impact, you should conduct your own evaluation according to the criteria that matter to you. This post does not attempt to replace such an evaluation, but perhaps highlight some things to consider, and some solutions to look at.

Requirements

The focus of your project is implementing a great number of business rules for a mid size financial dataset. In particular,

  1. You want these rules to be easy to maintain
  2. Since you're dealing with financial data, correctness is of paramount importance.
  3. Since you want the option of having these rules written, or at least validated by, business people with little programming background, the language should be easy to learn and easy to use correctly

Evaluation Criteria

  1. for maintainability
    1. ability to structure and reuse code
  2. correctness
    1. test frameworks, continuous integration
    2. fixed-precision math, possibly with explicit control of rounding modes
  3. easy to learn
    1. well known, widely available learning materials
    2. devoid of unnecessary complexity
  4. easy to use correctly
    1. modern development environment, featuring
      1. syntax highlighting
      2. errors shown as you type
      3. code completion
      4. linting tools
      5. code style tools
    2. static typesystem to catch typos
    3. language devoid of unnecessary pitfalls that entrap newbies

Comparision

(in a real eval, I'd rank every solution against every requirement, but that's a bit too much work for a codidact post, so I am focusing on essentials here)

Drools

I have worked with Drools years ago. At the time, it offered little support for code reuse, and wasn't very good at structuring code. The development tooling was clearly inferior to a general purpose programming languages, and testing was an afterthought. Web-editor available. We replaced it with hand-written Java as soon as the customer realized they couldn't maintain the rules themselves.

Java / C#

Mature development tooling including static type system. Mature libraries. Established tools for testing and continuous integration. Can be a bit boiler-platey. Code easy to structure and reuse.

Java: Fixed precision math available, but cumbersome to use.

Python

No comment since I have no experience with it.

TypeScript

Mature web-based development tooling including static type system. Decent libraries. Established tools for testing and CI. Code easy to structure and reuse. Less boiler-platey that Java; code is often more compact and readable.

General Advice

When evaluating a business rules language, I recommend keeping the entire software development life cycle in mind: business rules are not just written, they are also tested, versioned, deployed, documented and maintained.

General purpose programming languages offer all that, but can be hard to get into for non-programmers.

In contrast, dedicated business rules languages are easy to get into, but offer little support to structure or maintain complex code. They are thus best suited if rules are simple, and change frequently.

Overall though, my impression is that the domain of "business rules" is not sufficiently different from general purpose programming to benefit significantly from dedicated technologies.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

+0
−10

First of all, I don't think that there is a specific good programming language for your project.

Python

Python is beginner-friendly. But Python programs can be slower than programs written in other languages. You can handle millions-millions data easily using Python. But when you compare Python to other programming languages, Python is slower. There's a library is which used for data analysis. That library's name is Pandas. It can speed up the speed of Python for tasks which are suitable for being represented as data frames.

Python offers ready solutions for big projects. Sometimes it is easier to write something in Python and rewrite it later in another language, if necessary. This give the startups the most valuable gift they require: time. Often trying to make a startup work is like being stuck in limbo—you are heading to a really good place, but you are not there yet. So the faster the startup reaches the other end of the rainbow, the better. Python is a language that is great for writing prototypes.

Go

When you compare Python with Go, Go wins.

It’s a Cloud-native language that is being applied to the leading development projects based on the Ethereum and Docker.

Go is a cross-platform language that allows you to use the operating system of your choice when compiling the code. Golang is fairly easy to install and have superior debugging quality helping it gain popularity over other languages.

You can easily build production-level software of your choice including a range of use cases from the popular web APIs to encryption software.

Although Go vs Python is a trending topic among the business community, both the programming languages are not only good for creating web applications but both help in automating tasks related to your business.

However, Python is very easy to read and write. The biggest companies like Facebook, Google, Instagram, etc have used Golang also.

Golang is useful for carrying out programming for scalable servers and large software systems. The Golang programming language was built to fill in the gaps of C++ and Java that Google came across while working with its servers and distributed systems.

Rust

SO has a blog on What is Rust and why is it so popular?. Currently, the use of Rust is increasing rapidly. In Rust programs, the error message explains beautifully where the problem is. Currently, lots of users are choosing Rust and Julia for big data analysis and data science.

The main one is obviously Mozilla Firefox, more precisely its layout engine. Another large Rust project is the Redox Operating System. Also Tor might migrate some of their code from C to Rust and in the more distant future, same could happen for both Linux and Windows, but that’s a stretch. Now obviously in the case of Linux, Linus Torvalds is going to protest, but Microsoft is debating using Rust to avoid some of the nagging memory bugs they’ve had in the past and which cost them a lot. Also, both Windows and Linux would probably only make use of Rust in a rather localized manner. Rewriting everything is just not feasible. ~ source.

Rust is also being used more frequently now on reasonably sized projects. ... Half of the respondents felt that Rust compiles times have improved, in particular for large codebases with at least 10,000 lines of code. Two-thirds of respondents believed there is now better library support, too. Companies large and small are using Rust in production all over the world, including Mozilla, Dropbox, npm, Postmates, Braintree and others. Rust programs also optimize quite well, sometimes better than C. While C is good for writing minimal code on byte-by-byte pointer-by-pointer level, Rust has powerful features for efficiently combining multiple functions or even whole libraries together.

C/C++/C#

I like these languages. Currently, lots of users are leaving these languages, because these languages need a lot of knowledge. You can't understand code easily in these languages. Even some graduated CSE students say that, I don't know why teachers taught us these languages. These languages are very hard to understand. I was a Python programmer also. When I took a book from a CSE student I saw that C/C++/C# needs a lot of knowledge. If you want to learn everything deeply, you can start with these. A data scientist said that Python is very easy for data analysis, but most of the backend work is done in C and C++. That's why teachers always teach C and C++ at first in CSE. It needs lot of logic.

The C programming language is so popular because it is known as the mother of all programming languages. This language is widely flexible to use memory management. C is the best option for system level programming language. Even, Linux was built using C and C++ also. Manjaro's git repo. C is perfectly suitable for building large projects in any field of programming.

However, it is, at heart, a systems programming language (as in close to the hardware), not an application programming language.

I've built pretty large applications in C, and it worked well. Would I have hired a programmer who couldn't do systems programming (understanding pointer arithmetic without thinking)? No way.

99% of today's programmers would be disqualified if we used C for applications. They need bulletproof object references and a GC. Even those don't help, at times.

Java

One of my favorite languages. Java is little bit hard, but not as hard as C or C++. Lots of big projects use Java also. Java is a little bit hard to read, too. If you are new to programming languages, I will suggest that you choose Golang or Python. If you have some knowledge on programming languages, you can choose Java. I give Java medium priority.

I believe I started using Java in 1997, not long after Java 1.1 saw the light of day. Since that time, by and large, I've really enjoyed programming in Java; although I confess these days, I'm as likely to be found writing Groovy scripts as "serious code" in Java.

Coming from a background in FORTRAN, PL/1, Pascal, and finally C, I found a lot of things to like about Java. Java was my first significant hands-on experience with object-oriented programming. By then, I had been programming for about 20 years, and it's probably safe to say I had some ideas about what mattered and what didn't. ~ visit the page to read more about Java

Java is a great powerful tool for building big projects that are easy to scale. You can use Java Platform to add as many features to the project as needed. Development environment comprises a wide choice of frameworks, plug-ins, APIs, libraries Runtime Environment and JVM (Java Virtual Machine).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

Most if not all examples seem to be general purpose languages, rather than fit to manage business rul... (6 comments)
Choose language (1 comment)

Sign up to answer this question »