Goldman Sachs Interview Question for Software Architects


Country: India
Interview Type: Phone Interview




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

We can have two separate Hierarchy
1. types of Data Source.
2. For Handling the format.
A controller entity which would read from the datasource and depending on the format would assign the respective format handler.

For serialization each format handler can decide how to write in their formats

- martin.mathew.2k11 April 24, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can look at the Java's java.io.Reader and java.io.Writer classes. These are abstract interfaces that can be used to read/write multiple sources/formats. Have generic methods like close(), read(), skip() in the reader interface and have your writer interface contain functions to write(), close(), save(), flush(), etc. The source/format of data is defined by the implementation you use for the abstract reader and writer.

For instance one format is String. To read and write the same we have a StringReader and a StringWriter. If you want to read from String but write to file then you use a StringReader(string) and write using the FileStreamWriter(filename).

- Imithya May 10, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

see java.io implementation. for interview, you can define 3 interfaces reader, writer, convert.
Client may call convert and reader, writer to get it converted.
managing multiple sources and multiple destination with dynamic algorithm, you can avail strategy with builder.

so ultimately , you will be using handle to read and write and select conversion using strategy.
or
while reading, you use strategy to normalize it and later provide converted data to client with another strategy and write

- vikas June 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Please Refer Builder Design Pattern,Its exactly suitable.

- Gangadhara June 23, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Interfaces: DataSource
	open()
	close()
	getData()
	getDataFormat()
Interfaces: Formatter
	format()
Interfaces: DataSourceReader
	public String read();
Interfaces: DataSourceWriter
	public void write();

public class WebserviceDataSourceReader implements DataSourceReader
{
	private DataSourceReader ds;
	private Formatter f;
	public WebserviceDataSourceReaded(DataSource ds, Formatter f)
	{
		this.ds = ds;
		this.f = f;
	}

	public String read()
	{
		ds.open();
		String data = f.format(ds.getData());
		ds.close();
		return data;
	}

};
/* There could be multiple different Formatter objects like XMLFormatter, IMGFormappter , TEXTFormatter etc
   There will be some factory which can send formmater depends on the DataSource.getDataType() return value

   The class that creates objects of DataSourceReader knows which DataSource & Formatter to be used for the specialized class
*/

- Rajib Banerjee June 24, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use Builder Pattern

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

This looks like a simple bridge design pattern solution.
Abstracton --> Format
Feld --> Stream
Refined Abstracton --> XMLFormat, JSON Format
Bridge interface --> Stream
Implementation --> DiskStream, NetworkStream etc.
This way we can add new formats and readers quite flexibly without complicating the whole design with unnecessary Inheritance heirarchy

- Amt August 17, 2014 | 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