rsk
BAN USER- 0of 0 votes
AnswersThere 'N' different types of routers and 'J' different types of jobs to be performed on all these routers. Design a system wherein user could easily perform these jobs on these routers.
- rsk in India
Ex- Say two types of routers are - DLink , Netgear. If user wants to change the IP address (a job), DLink exposes a public API to do it. NetGear needs the data in form of xml.
Was asked to design Entities involved and their communications, basic algorithm, data-storage logic if any.| Report Duplicate | Flag | PURGE
Amazon Software Development Manager Object Oriented Design
I relate this problem basically to a 'Mediator design pattern' type of model. I see three peer entities that inter-communicate : 'Owner', 'Tenant', 'Property'
So assuming we don't deal with millions of users/big data scenario here, we can may be use RDBMS for entire data storage. So backend design would be primarily three tables 'Owner', 'Property' and 'Tenant/guest'
An owner can have multiple properties, a tenant can be looking for multiple properties etc can be managed using key constraints.
Coming to Middle-tier design, an Interface called 'User' that is extended by both 'Owner' and 'Tenant'. 'User' has few contracts to adhere to such has 'Registration No, 'Type of user', 'Contact details' etc that owner and tenant can then full-fill during 'registration' process.
Then the third concrete class being 'property' . Has property Id, Name, location, type, price, owner, last updated, photos etc.
Fourth is the 'controller' (vis-a-vis Mediator) that manages following functions primarily
- Registering both parties
- Searching properties based on given criteria (location, type, availability date range, price, popularity, last updated etc)
- Requesting info (of owner, of property, of guest etc) here some info should be confidential
- Making/receiving payment
- Some AI stuff such has listing out 'relevant' ones based on location for instance, 'highly rated', 'other similar properties', 'deals' etc. This i kept apart from the basic search (2nd function) that 'Mediator would perform because this would be largely performed on aggregate level (i.e irrespective of user type, prop type etc)
Lastly UI layer could be ..at simple , four distinct pages. One for registration, one of search and pick and one for payment.
Reg aspects to consider, 'Kake' above considered it overall i guess. Only thing i want to add here is , when a property with given criteria cant be searched /unavailable then should the system show a nearest ones (like a loop) or just say not found, broaden your search ? . I often find this tricky with real-time sites. So thought worth considering.
Please let me know
Thanks, i guess these pretty much cover all peripheral aspects to be considered. But what could be the core approach to perform this ? . As in, if user wants to change an 'IP', how do we design the system such that , it then changes the IP config of all underlying 'TYPES' of routers (using their native approaches of xml, api etc) ?
Thanks once again
A mediator design pattern could be used here. 'AuctionSystem' class (and interface) could be the Mediator and 'Bidders' class (and interface) could be the colleagues.
1. AuctionSystem member functions -
MaintainProductList() //Basically an ArrayList or a hashMap with key as product Id and values as current bidders
AddBidders() //Add bidders to the productList bidding in a sorted order (to ease the query of topBidder) . Could use MaxHeap as well.
RemoveBidder(Bidder ID) // Remove and reheapify
UpdateBidder(Bidder ID, Long newValue) //To update the bidding value and re-organizing.
PublishBidResult(Product Id).
Optimisitc approach, all other operations can store the bidding values unsorted and whenever PublishBidResults() is called, heapify can be done to publish the top value.
2. Bidder class member functions could have
- makeBid( int Product Id, Long Value)
- Long getCurrentBidValue (int ProductId)
Ya, fundementally using 'Mediator' pattern i guess. Three fundemental objects i see are 'Aircraft' and 'ATS Controller' and 'Common Resources'. 'Aircraft' basically seeks permissions for various stages and Controller fundementaly validates and grants. In the process of validation, controller communicates with other 'Aircraft' objects and interacts with 'common resources'
Various operations/member functions across these classes could be as follows :
Aircraft :
-pre-flight activities
- take-off
-inFlight
- descent
-landing
Note - Every stage is time-bound, sending/receiving grants based on start/end times.
Controller/base
- Weather report engine (common for location)
-Grant pre-flight
-grant take-off
-Monitor inFlight route
- Monitor Arrivals, departures, transits
- Two-way Communication with Controllers at other locations
- Provide Alerts (categorized based on severity)
- Address emergenies ( Ex- Engage rescue flights when needed etc)
- Constantly poll all aircrafts in jurisdiction.
Note - Controller class can internally use 'descision trees' to 'Grant' a given permission based on interaction with other Aircraft objects and resources.
Also for basic departure and arrival grants, a priority queue could be maintained. Priority could be defined based on how close aircraft is to the base, fuel-level, Number of passengers, etc
Common Resources:
-Runways availability/condition
- Engineering staff
- Flight safety crew
ATS system as such is mission-critical and should be extremely fault-tolerant and with Zero down-time. To meet these goals, reduncancies could be present for 'Controller' objects (say primary, secondary controllers) which ensure to give grants/alerts . Also Controllers should continously 'Poll' the black-boxes (think of them as connected IPs) for constant 'in-touch' situation.
Please let me know your opinion on this design.
My idea is as follows -
1. For the storage of videos, the video files as such could be stored on the server (having an absolute pathId ) similarly 'Reviews' can be stored in flat file. Then there can be few DB tables such as 'Videos', 'Users' , 'Categories'. Videos table primarily has columns such as 'video_id, 'Name', 'Absolute path', 'Creator', 'Number of likes', 'Review location' , 'Category Ids' etc
Idea is to use RDMBS tables to efficiently query all the info associated with a given video, while storing the video file and set of reviews/comments in flat files, referring those using corresponding 'path locations'
2. Coming to Model layer design, could use a bit of 'strategy pattern' to identify basic objects as 'Users', 'Videos', 'Moderator/YouTube Controller'.
"User" class basically has all getters/setters for - user info , uploads done, videos liked, Categories subscribed to etc.
"Video" class basically has all info reg the Video by itself such has video_id, creator, methods to fetch number of likes, reviews, deletion logic etc.
"Moderator" class then interacts with User and Video for upload, fetchNPlay and Deletion etc.
Here the idea is to have a decoupling between these objects for addition/modification of any features, without impact others.
3. Coming to UI logic, scaling part, performance etc All that would primarily reside in the Moderator class. When many users are expected to parallely watch a video, there could be a memcache implemented for videos belonging to 'TopWatched', 'TopRated' , 'Trending Categories' etc (these would be technically methods in Moderator class). Also for performance, a particular video could be stored redundantly across servers/locations for multiple parallel fetches (but in this case, the logic to store the location could change a little to have - region wise location Ids, Primary/secondary locations etc). This could again be used NOT for all but for top viewed videos may be. Moderator can keep this list updated.
Please let me know your opinion on this design.
Repjoyceeallard, Associate at Adap.tv
Hi, i am working as a training manager as a business professional who assesses the growth and development needs of ...
Repgradyjvierra, Animator at Alliance Global Servies
Je suis Grady de Phoenix USA. Je travaille en tant que technicien de laboratoire clinique dans la société Samuels Men ...
RepMariaHobbs, Consultant at Adobe
Hi, I am Maria Hobbs from NewYork.Teach career development courses for designated areas. Develop, evaluate and revise course materials ...
Repileenjconnelly, Cloud Support Associate at Absolute Softech Ltd
I have extensive experience in providing breaking news and giving precise details to the viewers. Interested in leading/working with ...
Repaaronlustera, Android test engineer at Absolute Softech Ltd
My job is to help groups of people work together better, understand their common goals, and plan to achieve those ...
Repannarrathjen, Employee at 247quickbookshelp
Hello, My name is Anna and I am a medical records technician with 2 years of experience and achievements. I ...
I assume booking.com offers bookings of destinations, hotels, flights, resorts etc.
- rsk December 28, 2016If so, user can search for any of these 'broad categories'.
One simple approach could be to first have the user pre-select a category (Ex- trying to search for a resort), and internally have multiple tries storing a almost pre-defined list of resorts (using a compressed trie, if memory is not a issue). Also implement a 'LRU cache' mechanism to perform auto-suggest based on 'most recently' used names (under a given category) and remove 'least used ones from cache'.
If we want to give a capability to search for 'anything' (not category specific) then a common trie listing all supported destinations, properties etc can be shown. This could be memory heavy even with a caching logic. So we might have to perform the search in a distributed manner, for instance using a 'map-reduce' algo. Ex-One mapping worker internally crawls for all 'places', one for all 'properties' etc. In order to support such crawling, while storing in trie, we need to 'prefix' each value(atleast leaves) with a category code.
Thanks.