How we can achieve writing reusable and modular code in an Enterprise code. What are the basics to get started
How we can achieve writing reusable and modular code
155 views Asked by VIKRAM SINGH CHOUHAN At
1
There are 1 answers
Related Questions in REUSABILITY
- How to write a reusable DB transaction wrapper?
- Reusable/Shared Angular material autocomplete returns null even after selection even with ControlValueAccessor
- React: Reusable components design pattern
- List unreachable servers in Ansible using a reusable playbook
- Is it possible to accessing Python files from other local cloned repos with "Enable IntelliSense for custom package locations"
- Can a DataTemplate be reused by binding it to different properties with the same data type?
- VB.NET VS2017 net 4.6.1 moving AspNetIdentity 2.2.2 code from website project to reusable DLL since I have 80+ web sites to convert
- Does basic Python have any equivalent to extending Django templates?
- openSSL TLSv1_3 session resumption
- No overload matches this call in Next.js/Typescript
- How to skip *.json files with dep5 when creating reuse annotations?
- Component reusable issue in Angular
- Is it bad to use an instance of an operator to access child class variables from a parent reference?
- react component reusabilty
- How to define single context for all test subclasses with testcontainer?
Related Questions in MAINTAINABILITY
- How is proper way to repiar npm vulnarabilities in project?
- How to maintain enums (and adding new values) in a very large codebase
- Angular How to easier maintain build in i18n translations
- Python: Should I save PyPi packages offline as a backup?
- Is calling an API from inside an initializer in Python bad?
- Invoke overridden virtual methods of a derived class without exposing them
- How we can achieve writing reusable and modular code
- How to maintain Composite Pattern efficiency with increasing components?
- Refactoring instanceof
- Should I declare a number as constant if it is passed as a parameter to a meaningful named function?
- Prevent improper use of a User Defined Data Structure and Making DS resuable
- Recommendations to learn Refactoring
- Multi language apps into one - best strategy
- Best practices for creating a customized report based on user form input?
- Where domain logic should go when there is no aggregate?
Related Questions in CODE-STANDARDS
- Cppcheck suppress unusedFunction for user library calls?
- PhpStorm Catch sentence with multiple exception classes PSR-12 code style
- Code standards check before commit in PyCharm
- Is it Pythonic to import an external symbol imported into another module?
- Structure Policy for Django / Python Libraries
- Not operator or Strict comparison on false?
- How to wrap long lines of Apache Camel Java DSL code
- Exceptions to control execution flow in managed .NET code - a good practice or not?
- Code Standard - is it better to have a getter/setter even though they are never used?
- How we can achieve writing reusable and modular code
- Are there penalties for just using the new keyword instead of creating a class variable before calling the class method?
- How to format algebric code for readability
- Where can I set correct formating for implementations generated by Visual Studio?
- Sonarqube supports rules to enforce coding standards or not
- Coding standards: Should one always write 'return' at the end of every method or function?
Related Questions in TESTABILITY
- In C#, what is the best way handle dependency inject a class which consumes multiple interfaces?
- How we can achieve writing reusable and modular code
- stability test of ARDL model in R
- Can I write any meaningful unit test in this scenario?
- Verifying the original value of an argument property with Mockito, before it's changed by another thread
- How make code that uses global dynamic properties unit testable?
- Combining testable code with static method dispatch in swift
- Are there exceptions to no code in view model?
- Mocking locally created objects in java using Mockito2
- whats wrong with a simple IOC container class?
- How to create a class with a list of elements from another class without breaking the dependency injection rule?
- Testing fails to import sub dependency - @testable import SubModule - Use of undeclared type 'InternalSubModuleType'
- Console.Writeline in class method. Better Design
- Node.js: exporting class/prototype vs. instance
- What is the correct way here to modify/refactor product code to support integration testing?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Writing modular code is an art of programming.
In Enterprise products, writing reusable code is a key to make your product reliable, testable and maintainable for long run. Modular and reusable code sits at the very heart of any standard product.
Let's take an example to understand how we can convert and existing code into more modular and reusable code.
Let say there exist a method/logic in the product which take an 1-D array of positive integers as input and evaluate the sum of all the elements.
This method actually evaluates the total transaction amount of a user in a given year. Consider that this was the initial business requirement and hence code has been written in such a fashion.
Now, let's say a new business requirement has come, which wants to evaluate the user transactions of a the first half of the year. How you are going to achieve it? Maybe writing one more method which can evaluate for first half of the year. Correct. Let see how that method looks like.
Cool we have done it. :) But can it be done in any other way, or may be a better way. Let see.
We can actually write a more generic/reusable method which can give the sum of transactions for a given period. Something like this
Now we can call this reusable method for both of the existing requirement.
And even any future requirements, lets say for the month of January, we need to simply call same method like this
Why we are looking for better way? may be to accommodate future requirements and reducing line of code.
What we achieved:
Thanks!