• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

My project design

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For my coursework I have to build a login application. I hope this is the right place to ask this question, but this is my plan for the project I was wondering if someone can see if I am on the right track.
The project is to create a GUI login screen that takes in a username and password, checks them against an array of username and passwords. If the submitted username and password exist in the arrays then the user is allowed into the sytem, if not then they are given a error message.
My plan for this project is to create a central class which holds the Main method and creates the GUI Page and form. I then want to create a new class which creates and holds the two arrays of username and passwords. It also has two "get" methods that retrieve the submitted username and password. Then within the same class I am going to loop through each array and check that submitted username and password exist. If they do then the class will return a Boolean value of "true" or "false" depending on the outcome of the loop.
This Boolean value is checked in the Main class, then depending on the value either a message is displayed telling the user that their login has failed or it runs another class that calls the welcome page.
This is my plan, am I trying to do to much all within a few number of classes or am I doing this in a OO way?
Any suggestions.
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From an OO standpoint: sounds acceptably OO, though you might want to consider how you are modeling the login window.
Nothing to do with OO, but are you just going to search for the username in the username array, and the password in the password array? If so, what is to prevent user B who wants to log in as user A from getting in by using user A's username, and user B's own password?
You might want to check out java.util.Map and see if it does something that might help you here.
 
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Stephen Adams

am I doing this in a OO way?


A guideline is applied in your cases, it is elementary business process
A task performed by one person in one place at one time, in response to a business event, which adds meansurable business value and leaves the data in a consistent state.
It is used to find the user goal and define a use case for each. Is "login" a user level goal?
Firstly, you should determine the above question.
It is a question in OO analysis.
Anyway, you can identify some objects in the use case, if you wrote a use case for "login". Then identifying all of object uses the method called "noun phase" or other method. Then using sequence diagram to understand how to implement your design in the coding. The design involves some patterns. I think that you may apply creator pattern, fasc,ade pattern. It may contain other's pattern.
I think that design without an exactly correct answer, because design is art.
 
Stephen Adams
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Siu,
Thanks for the reply, your idea of writing a use case is extremely useful (no pun intended). What I have been doing is seeing the application from how a user would use the system once built, not how would a user login and how could I build a system that would match that users needs.
 
Author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a brief discussion of security and a simple pattern in my book Enterprise Patterns and MDA on page 128. You might be able to get it out of your library.
The essential process is:
  • Identify party - check the party exists in the security database
  • authenticate party - validate their password[LIST]
  • handle security violation - what happens if the password is invalid
  • assign permissions
  • operate system[/LIST]
    There is invariably a maximum number of logon attempts allowed (usually 3) to prevent brute force hacking. If the maximum number of attempts is exceeded, the use account may be frozen pending investigation. There is a more complete discussion in Enterprise Patterns.
  •  
    Happily living in the valley of the dried frogs with a few tiny ads.
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic