Interview Question for Software Architects


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

Need more information.

- krishna January 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Need more information.

- krishna January 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I have edited the question. Please inform what more details you need.

- SKJ January 22, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

If you want to notify other system services module you need to use communication module that may need pub-sub architecture. You may need to put update request in a queue so that all updates pass on to subscribed services.

- Himanshu Jain January 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

True.
I have updated the question with more points to focus while designing. Let's discuss in more in-depth details about the design of the system

- SKJ January 22, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

* one way is to expose different register interfaces for different data interested. Anyother thoughts ?

* CatalogManager can assign some sequence numbers to each message and the clients can order the messages based on them.

* We would need Event Manager which models Pub-Sub pattern for sure. It is Event Manager's responsibility to ensure the messages reach the consumer. It could be implemented by keeping the outgoing messages in a queue and having some retry logic in the event manager if the message transfer fails.

* EventManager's responsibility to remove the message from the queue once the transfer is successful without exceptions. This will ensure the message is sent only once.

- Anonymous January 25, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Abstract message service to a MessageCenter class.

@Singleton
public abstract class MessageCenter {
	public static getInstance()
	public push(Event e, Object data);
	public on(Event e, EventHandler eh)
	Enum EVENT_TYPE {
		NEW_PROD
		PROD_INFO_CHANGE
		...
	}

}
Catalog manager will push diff. kind of events when data updated. Other backends register to events they are interested in. Like

MessageCenter.getInstance.on(MessageCenter.EVENT_TYPE.NEW_PROD, new NewProdListener(data){//deal with the info...

}
Where to put message queue depends on which part have larger amount of transaction and need less delay. e.g. queueing message in each backend will make CatalogManager faster: it will just keep fireing events, and each backend will deal with eventually consistency. Given in your description, CatalogManager seems to touch all transactions, it'll easily become a bottleneck, I'd recommand queueing message in all other backends. Note for CatalogManager pushing events are async, so it won't block at all.

- John.hzs1988 January 29, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think using Observer pattern is more appropriate in this case.

- Anil kumar reddy. March 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can have an event class :---

Class Event
{
Seller id;
Product ID;
Map<attributeID, old value>
Map <attributeID, new value>

}
For shipping event you can make a new class inherited from event class having one more bool variable IsDimensionChanged. Other services will subscribe the event.
As soon as event will raise, you can insert in queue. As insertion is very common and we have to sync, we will make make multiple queues of small size, rather than making one queue for big size. Once one queue will full or after particular timeout, listener will start listening.
In this way, reader and writer will have lock on different queue.For updating database, we can use nosql database and update whole class of catalogue which has been modified in database along with catalogue id. It could be done after configured time.

For fault tolerant purpose, we can do 2 things :--
1- introduce event id which would be unique and pass in every message. Every subcriber will maintain of queue of those eventid which it has responded. This queue will flush after some time.
2- Every message queue would be written in memory mapped files with queue id. Once reader will read whole queue, they will remove this file. Therefore if fault will occur while reading, system will restore from least queue id file and start reading. this id could be timestamp.

- Phoenix August 13, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More