Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Mridul Gupta
2,144 Points[Need Help] My own project Ledger App..
So, I was working on my own project of making my own ledger application. I am not adding too many features right now, I am posting a link of my trello so that you guys can see.
https://trello.com/b/BU4lj6zY/ledger-app#
But the main problem that i am facing is to where to start the project. :/ I will give the points that i have thought of to start making the program :-
1.) Make a User Class - That will contain only basic info of the users and an List<Account> member that log into the application. (No password right now, just enter yor name and you are in and you can seee the info of your accounts)
2.)Make an Interface (Accounts)
3.) Classes bank,post office,mutual funds that will implement Accounts . and we can do upcasting in the list of the user class.
4.) make a LedgerApplication Class that will have all the interface of the application.
Please share your views guys. I really need your help. Any more ideas on the working of application and any idea to make it better or add some more features. All are welcome.
Thanks a lot.
1 Answer
Harry James
14,780 PointsHey Mridul!
This is totally the right idea to starting a project - define your MVP and plan out what you're going to do.
So, classes like User are great - you can specify the fields that each user has, add getters/setters and then organise all of your Users together in an array/collection.
Interfaces are not a must but in a case like yours, they will come in extremely handy. Each implementer has to follow the set of rules set by the interface, such as what methods they must use, which will totally benefit you for not rewriting code that you don't need to (Remember, Don't Repeat Yourself!).
I think that you've got this sorted and you've planned it all really well so, get started! Now no matter what, don't add extra features just yet - if you think you might forget them, put them in a separate backlog. It's really easy to overcomplicate things this way and I always fall for this. Get the program working, then improve on it :)
As always, if you need to ask us about something then just give one of us a shout. That's what we're here for :)
Mridul Gupta
2,144 PointsMridul Gupta
2,144 Pointsok thanks Harry,
I wanted to ask one thing. I was also thinking about Making an Interface Account , then make another interface Bank and implement Account ,and then making the desired classes for Bank (like Savings, Deposits, etc) and implement Bank from them.
So its like - Interface -> Interface -> Classes
Is this a good way or making it too complicated.
I mean whats really going on in my mind is how to know, when to create and interfaces and when to stop and start making classes.
Harry James
14,780 PointsHarry James
14,780 PointsMaking interfaces implement interfaces can sure make things confusing for someone new to your project but I still think that it's more beneficial.
Again, it all relates back to not repeating yourself. If you're going to need to repeat yourself, stop for a minute and think that perhaps a class/interface would be better here. It means that if you need to change your code then you can do so in one place and that change will be reflected everywhere else.
This also goes into separation of concerns in that each class/interface has a separate duty, which will greatly benefit anyone on your project (Including yourself). From a glance, you can see what that file is doing. If someone gave you a file with all of their code in, not organised in any way then it's inevitable that you're going to be spending more time figuring out what that code is doing.
I personally feel like when you have sub-interfaces you should document these, in the branch style you did. Like this:
Either do this in a document, or in comments of your code. It allows you to again understand how the code is working at a quick glance :)
Mridul Gupta
2,144 PointsMridul Gupta
2,144 PointsThat was helpful ...Thanks Harry :-)