• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to build project architecture from project specification?

 
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I visited a Java course this summer and now I've been given a task to do with other people that visited the course. I received a project specification and since I'm the first guy to dive in they asked me to do the project architecture and I have no idea what to do. How do I do this? Any advice?

It's about a banking system which should hold records for the employees, clients and processes. The employees should be able to do basic transactions as well as withdrawal and deposit from client's savings account, receive payments on grounds of loans and receive applications for opening a savings account and applications for loans. Some clients will have a VIP status based on their frequency at the bank, amount of deposits and withdrawals and time passed since the client first joined the bank. Every VIP client will have a 24/7 available employee. Which of the employees gets assigned to a VIP client gets determined by a board of managers.

This is just the tip of the iceberg from the specification so you guys can get an idea. Desperately need guidance on how this should look and be done.

 
Bartender
Posts: 6115
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a first pass I suggest making a list of nouns and verbs in the requirements. Nouns typically become classes and verbs become methods. As an example:
Employee (noun)
Account (noun)
Client (noun)
deposit (verb)
withdraw (verb)

You can also look for  "is-a" and "has-a" relationships. "Is-a" often becomes inheritance and "has-a" becomes aggregation which typically becomes a field with supporting methods. Example;
Client HAS-A VIP status
Client HAS-AN Account
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice, thanks Carey, that cleared things up a bit.

So basically I need to define what is needed and order the hierarchy of classes, interfaces etc?

What would be the second pass?

Is making a diagram of the architecture in the end good practice?

What's good and what's bad architecture?

I'll ask you guys everything since I couldn't find good resources on the internet.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turns out the first pass isn't going as smooth as expected :/
 
Marshal
Posts: 65365
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darko Jakimovski wrote:. . . What would be the second pass?

Don't know. that would be for you to decide. One possibility is simplifying the whole architecture by omitting parts. Add those parts back later. Work out which parts are dispensable and which indispensable. Maybe VIP status is dispensable and loan repayments are indispensable. Implement the dispensable parts after you have got the basics working.

Is making a diagram of the architecture in the end good practice?

Yes. Make diagrams at all stages if you think they would help.
Create yourself a Git repository and store all you thoughts in it. Diagrams and everything. Do that from the very first stage.

What's good and what's bad architecture?

The diagrams should look straightforward. If you have lots of crossing arrows and lines, consider whether your diagram is right. If you can get rid of the crossings by moving one class, you have drawn that class in the wrong place Move it.

I'll ask you guys everything since I couldn't find good resources on the internet.

What a nice thing to say
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more question. Do I need to include DataBase relations in the diagram? Or should they be implicit? Or just the classes, fields and methods?

Thanks Campbell, you are the man!I'll work on it and post when I have something I'm not too embarrassed to post
 
Campbell Ritchie
Marshal
Posts: 65365
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a pleasure

Surely you will have a database connection class somewhere. That must be included in the diagram.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presuming you are a beginner, look up on Enum(s) and where you might implement them, since sometimes they are better choice then to create a class. For instance, a Client may be promoted to a VIP_CLIENT at some point. Just as an option...Srecno
 
Carey Brown
Bartender
Posts: 6115
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Sheriff
Posts: 13675
226
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would back the horse up a little bit. What exactly do you mean by "project architecture"?

Nothing discussed so far stand out to me as "architecture," at least not how I think of software architecture. Before you go any further, you might want to make sure you and everybody else contributing to this thread are clear on what exactly "architecture" means here.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike I thought about Enums but for now I don't have a concrete idea of implementing them in the project since the specification only asks for a VIP status I thought I would have a boolean field in the Client class. But Enums will make the code more flexible and reusable on the other hand. Hmmm...

Thanks Carey I thought about that too, like have a parent Account class and Savings and Checking sub classes so I can put them in a Collection field in the Client class. Does that sound ok?

 
Junilu Lacar
Sheriff
Posts: 13675
226
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I hear "software architecture," the first thing that comes to my mind is something that Martin Fowler wrote https://martinfowler.com/architecture/ and some of the other things referenced on this page https://martinfowler.com/tags/application%20architecture.html

I also vaguely remember Fowler saying something about architecture being "things that are difficult to change," kind of like the foundation of a house or the chassis of a car.
 
Junilu Lacar
Sheriff
Posts: 13675
226
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darko Jakimovski wrote:I thought about that too, like have a parent Account class and Savings and Checking sub classes so I can put them in a Collection field in the Client class. Does that sound ok?


In my experience, this kind of approach more often than not leads to over-complex and over-engineered designs. Thinking solely about objects/classes, attributes, and relationships traps you in a seemingly endless cycle of conjecture and pre-emptive design.

I would start with behaviors or outcomes. Identify the users of your system and what they need to do that will be facilitated by the system. Then identify different ways they will interact with the system and how they benefit from being able to do that.

That's where I would start. Only when I have a good idea of who I'm building the system for and what they get out of using the system do I start thinking about how to represent those actions and ideas as software objects and behaviors.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whoa, thanks for the feedback Junilu. I'll keep that in mind. I really want to nail this and want it to be airtight, bulletproof and foolproof. Coderanch should be given control over the universe.
 
Campbell Ritchie
Marshal
Posts: 65365
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darko Jakimovski wrote:. . . Enums will make the code more flexible . . . have a parent Account class and Savings and Checking sub classes so I can put them in a Collection field in the Client class. Does that sound ok?  

No.

Maybe you will implement the code like that later, but you are straying from architecture into implementation. Do not think of implementation details like that yet. A customer can have any number of accounts, so simply write that down. Don't write down how those accounts are to be collected.

By the way: can a customer/client have zero accounts? I would think the number of accounts must be 1…n. Later on, you might like to design something to record clients/customers with 0  accounts, but they are now ex‑customers.

Follow Junilu's suggestions, which are probably better than mine.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a client can have zero accounts, that's a part of the specification. In such cases the CounterEmployee needs to log the transaction with the client's SSN, time and amount of transaction also offer a registration form if the client is not registered at the bank and only then log them in the Client Database.

As suggestions go, there are no bad and good at this point the result will tell which were good or  bad I guess

Thanks again Campbell.
 
Carey Brown
Bartender
Posts: 6115
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darko Jakimovski wrote:....client's SSN....

This sends chills up my spine. A client needs a unique ID but in no way should that be related to a SSN. IF a system has SSNs then they should be encrypted. SSN's are not guaranteed to be unique, though most of the country treats them like they are.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it's not exactly SSN, I just don't know the proper translation (birth registry number?). In my country we have a unique citizen number based on the date of birth, gender, county and number of baby born on the day and is guaranteed to be unique. Which we use everywhere for all sorts of stuff. I apologize for not clearing that up. Also we use that number even if we aren't registered clients at a certain bank. Anyways all registered clients will have their client ID of course.
 
Mike Gosling
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote: This sends chills up my spine. A client needs a unique ID but in no way should that be related to a SSN.


Darko Jakimovski wrote:Anyways all registered clients will have their client ID of course.



I understand what you meant by SSN. If I'm not mistaken, what Carey wanted to say is that you need to have some way (a method usually) which resolves issue of having unique identifier for each object, or at least, unique identifier for same type of objects (Client, Bank, Transaction etc). What will happen if you were to build an app, lets say, Animal Shelter Management System where everything revolves around Animal. How will you assign "SSN" to each Animal (I'm almost sure they have something like SSN, but you get the point)?

For example, when all references between objects are established, you will usually have them in some static ArrayList or a HashMap. In case of HashMap, you may want to store each object under key which is actually that object's ID.
That method would look something like this.



 
Junilu Lacar
Sheriff
Posts: 13675
226
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This discussion/thread seems to be going all over the place. Are you still interested in talking about architecture or are you going to stay trapped in the trap I warned you you're likely to get trapped in?

I wrote:this kind of approach more often than not leads to over-complex and over-engineered designs. ... traps you in a seemingly endless cycle of conjecture and pre-emptive design.

 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, I get it. But, the implementation of getting a unique ID for each object is not the issue and having unique IDs for registered clients is a must.
Using the SSN (or EMBG) for non registered clients is where the discussion went off the rails. Example: I go into a bank that I don't have an account in and want to deposit a certain amount to an account that exists in that same or another bank in that case I give them my personal ID and the deposit is executed without me having an account at that bank nor using any of my accounts of other banks (if it is a cash deposit).

The specification asks for such case clients to be given a form to fill if they want an account at the bank and it's not mandatory.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar... indeed.

So far I got most of the classes I'll need, fields for them. Now working on methods and Enums.
 
Junilu Lacar
Sheriff
Posts: 13675
226
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darko Jakimovski wrote:So far I got most of the classes I'll need, fields for them. Now working on methods and Enums.


Yeah, but that's not architecture though. I hope you didn't get that impression from this thread but classes and fields and methods and enums are NOT what makes up an architecture, at least not from what I know architecture to be.
 
Campbell Ritchie
Marshal
Posts: 65365
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe show us a little diagram of what you have got so far, please.
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the time being I have no diagrams drawn, I have no idea what I am doing obviously but I think that the diagrams should show how everything interacts with everything.
These are the last scribbles I've done.




https://ibb.co/fD3sHkq
 
Rancher
Posts: 99
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good start. It's worth noticing that both Employee and Client have some common attributes.

I'm not sure how often UML diagrams are used in the real world but for my small, silly projects I use class diagrams and activity diagrams.

For drawing them I use Lucidchart which is pretty cool if you love diagrams (who doesn't?)
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I installed a UML plug in on netbeans and started doing it there, I'll post it once I have something worth posting. Thank you everybody. I apologize for my previous post
 
Darko Jakimovski
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So guys this is what I got so far, there are still a lot of things I need to cover. Am I going in the right direction?

https://imgur.com/2QlH0Sl
 
Campbell Ritchie
Marshal
Posts: 65365
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the images here rather than people having to go to a different website?
What you have looks good (), but,
  • 1: Maybe you have got too much detail for the current stage.
  • 2: Have you shown accounts anywhere?
  • 3: Would a Client have an account number? Surely the account has the number and the client has the account?
  • 4: You have, I think, too many fields for the client class. Consider dividing up the fields into identification, accounts, etc., to reduce the number of fields in client. You will then have a few more classes.
  •  
    Darko Jakimovski
    Ranch Hand
    Posts: 48
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yeah I tried posting the images but no preview was available, that's why I'm posting the links...

    I thought about the account number being recorded in the account itself but it just struck me that I used an interface... Maybe I'll change that to an abstract class so I can do that. Also maybe have a different NumberGenerator class that will generate account numbers, client IDs, employee IDs etc...

    I'll work on it some more and post again, thanks for the feedback Campbell.

     
    Junilu Lacar
    Sheriff
    Posts: 13675
    226
    Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I've already tried pointing out that this isn't architecture and that you're headed down a path to over-engineering and over-complexity but you seem determined to keep going so, oh well. I guess you have to find out the hard way.

    Your diagram shows only getters and setters for some classes, an early sign of an anemic domain model.

    There is also a danger of improper use of inheritance with Client and Employee being subclasses of Person. If you will have any code that is programmed to the Person type, be sure to consider whether or or not it will work with either subclass or any other subclass of Person. This is in keeping with the Liskov Substitution Principle. If code that uses Person can only work with a specific subtype, then you have a design smell.

    And in keeping with the LSP, prefer using List as the declared type instead of ArrayList. Prefer declaring with interface types instead of implementation types.

    Also, a phone number is not an int, even though it is (usually) made up of only digits. It makes no sense to do any kind of int operation on a phone number. Instead, astute designers use String for phone numbers.



     
    Darko Jakimovski
    Ranch Hand
    Posts: 48
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you so much Junilu, this time you gave my a lot to chew on. I'll go through as much as possible of Martin Fowler and Eric Evan's research on the subject. You sir have my gratitude.
     
    Campbell Ritchie
    Marshal
    Posts: 65365
    248
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Junilu Lacar wrote:. . . prefer using List as the declared type instead of ArrayList. . . .

    At this stage, I would go one further and write, “any number of accounts,” and change that to List or similar at a later stage of the process.
     
    Junilu Lacar
    Sheriff
    Posts: 13675
    226
    Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Here's a nice article that contrasts "software architecture" and "software design" - https://codeburst.io/software-architecture-the-difference-between-architecture-and-design-7936abdd5830
     
    Would you like to try a free sample? Today we are featuring tiny ads:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!