I believe this questions and answer are still related to anyone who is looking for a job as software architect or senior developer. The questions are originally posted by Scott Hanselmann long time ago here . If you are crafty and curious enough I find it useful for you to go to next step in your career as Software Architect, despite the fact of whether my answer below is correct or not:) I also link it into some of Wikipedia to relate to what I put in my answers in green.
I skip all the behavioural question for yourself to answer.
- What is something substantive that you’ve done to improve as a developer in your career?
Trying different sort of technology to keep yourself updated. - Would you call yourself a craftsman (craftsperson) and what does that word mean to you?
- Implement a <basic data structure> using <some language> on <paper|whiteboard|notepad>.
You can create an easy array to show it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{ string[] myColors ={“blue”,”red”,”pink”,”a”};
//Console.WriteLine(myColors[0]);Array.Reverse(myColors);
int i;
for (i=0;i<4;i++)
{
Console.WriteLine(myColors[i]);
}
}
}
}
- What is SOLID? Wikipedia, the free encyclopedia
http://dotnetinter.livejournal.com/83501.html
It’s an acronym of five object oriented design principles which when applied together make our system an easy maintenance system.It simply helps us to avoid the bad design.
Five principles are
- S – SRP – Single Responsibility Principle
Every software module should have only one reason to change - O – OCP – Open closed principle
Software modules should be closed for modifications but open for extension - L – LSP – Liskov substitution principle
Subclasses should be substitutable for base classes. - I – ISP– Interface Segregation principle
Clients should not be forced to implement interfaces they don’t use. OR Many client specific interfaces are better than one general purpose interface - D – DIP– Dependency Inversion principle
High level modules should not depend upon low level modules. Rather, both should depend upon abstraction
- Why is the Single Responsibility Principle important?
https://en.wikipedia.org/wiki/Single_responsibility_principle
The single responsibility principle states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class.
- What is Inversion of Control?
In software engineering, inversion of control (IoC) is a design principle in which custom-written portions of a computer program receive the flow of control from a generic framework. A software architecture with this design inverts control as compared to traditional procedural programming: in traditional programming, the custom code that expresses the purpose of the program calls into reusable libraries to take care of generic tasks, but with inversion of control, it is the framework that calls into the custom, or task-specific, code. https://en.wikipedia.org/wiki/Inversion_of_control
How does that relate to dependency injection? dependency injection is a software design pattern that implements inversion of control for resolving dependencies. https://en.wikipedia.org/wiki/Dependency_injection
- How does a 3 tier application differ from a 2 tier one?
N-tier and 3-tier are architectural deployment styles that describe the separation of functionality into segments in much the same way as the layered style, but with each segment being a tier that can be located on a physically separate computer.
https://msdn.microsoft.com/en-us/library/ee658117.aspx#NTier3TierStyle
The main benefits of the N-tier/3-tier architectural style are:
- Maintainability. Because each tier is independent of the other tiers, updates or changes can be carried out without affecting the application as a whole.
- Scalability. Because tiers are based on the deployment of layers, scaling out an application is reasonably straightforward.
- Flexibility. Because each tier can be managed or scaled independently, flexibility is increased.
- Availability. Applications can exploit the modular architecture of enabling systems using easily scalable components, which increases availability.
2 client architecture is also known as client server architecture that is traditionally used that connect client to several servers. Example of 2 client architecture: client -queue-client systems.P2P applications.
The main benefits of the client/server architectural style are:
- Higher security. All data is stored on the server, which generally offers a greater control of security than client machines.
- Centralized data access. Because data is stored only on the server, access and updates to the data are far easier to administer than in other architectural styles.
- Ease of maintenance. Roles and responsibilities of a computing system are distributed among several servers that are known to each other through a network. This ensures that a client remains unaware and unaffected by a server repair, upgrade, or relocation.
- Why are interfaces important?
Interfaces are important because they allow polymorphic behavior for applications. Interfaces can be passed to functions where the actual class instance isn’t known. As long as the instance that is passed to the function call inherits from the interface, the code will execute. Another great feature of using interfaces is being able to mock or stub the objects by creating “dummy” classes that have the same method signatures as the real objects, but don’t have the same implementations.
- What is the Repository pattern? The Factory Pattern? Why are patterns important? http://mathewrphillips.blogspot.ch/2012/01/questions-for-senior-software-engineer.html
The repository pattern is a layer of abstraction between the domain model and the database. It provides domain objects in a collection that can be operated on like a list. It decouples the objects in the domain from the underlying database schema and operations.
The factory pattern is a method for encapsulating the creation of complex objects that require reusable code. For example, instead of a 5 step process for creating a dependency inside of an object, a factory method is called that returns that dependency fully configured in 1 line of code.
Patterns like these are important for software development because they reduce duplication of functionality and coupling of pieces of code. They allow requirements to be specified in a repeatable and understandable manner. And they also create code that avoids many of the pitfalls that the patterns were created to combat in the first place.
- What are some examples of anti-patterns?
An anti-pattern is a common response to a recurring problem that is usually ineffective and risks being highly counterproductive.Spaghetti code(Programs whose structure is barely comprehensible, especially because of misuse of code structures), soft code(Storing business logic in configuration files rather than source code) ,copy and paste, lasagna code: Programs whose structure consists of too many layers
https://en.wikipedia.org/wiki/Anti-pattern
- Who are the Gang of Four? Why should you care?
Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
https://en.wikipedia.org/wiki/Design_Patterns
Because GoF design patterns are consider the foundation of others design pattern.
http://www.blackwasp.co.uk/gofpatterns.aspx
- How do the MVP, MVC, and MVVM patterns relate? When are they appropriate?
Used MVP for Windows Form, Use MVC for ASP.NET MVC, use MVVM in Silverlight or mobile development
- Use in situations where binding via a datacontext is not possible.
- Windows Forms is a perfect example of this. In order to separate the view from the model, a presenter is needed. Since the view cannot directly bind to the presenter, information must be passed to it view an interface (IView).
MVVM
- Use in situations where binding via a datacontext is possible. Why? The various IView interfaces for each view are removed which means less code to maintain.
- Some examples where MVVM is possible include WPF and javascript projects using Knockout.
MVC
- Use in situations where the connection between the view and the rest of the program is not always available (and you can’t effectively employ MVVM or MVP).
- This clearly describes the situation where a web API is separated from the data sent to the client browsers. Microsoft’s ASP.NET MVC is a great tool for managing such situations and provides a very clear MVC framework.
- Explain the concept of Separation of Concerns and it’s pros and cons.
In computer science, separation of concerns (SoC) is a design principle for separating a computer program into distinct sections, such that each section addresses a separate concern. A concern is a set of information that affects the code of a computer program. A concern can be as general as the details of the hardware the code is being optimized for, or as specific as the name of a class to instantiate.
Answers from http://mathewrphillips.blogspot.ch/2012/01/questions-for-senior-software-engineer.html
Separation of concerns is how someone organizes code. When done correctly with methods like encapsulation, one can create code that is logically organized. Separate “concerns” or activities can be modified without affecting surrounding code. One pitfall of separating concerns lies in how well it is done. Imagine spaghetti code with 10 classes to do the job of one class. They “separate” things without reference to what goes where and why.
- Name three primary attributes of object-oriented design. Describe what they mean and why they’re important.
- Encapsulation: the hiding of data implementation by restricting access to accessors and mutators.
- Abstraction: template for writing classes, tightly related to encapsulation.
- Inheritance: By deriving classes we create what is often referred to as a class hierarchy. The class at the top of the hierarchy is known as the base class and the derived classes as subclasses. Any number of classes may be derived from a class. It is only possible for a derived class to inherit from one As such, C# is known as a single inheritance programming language.
- Describe a pattern that is NOT the Factory Pattern? How is it used and when?
http://stackoverflow.com/questions/557742/dependency-injection-vs-factory-pattern
Dependency Injection(DI)
When using a factory your code is still actually responsible for creating objects. By DI you outsource that responsibility to another class or a framework, which is separate from your code.
- You have just been put in charge of a legacy code project with maintainability problems. What kind of things would you look to improve to get the project on a stable footing?
- Show me a portfolio of all the applications you worked on, and tell me how you contributed to design them.
- What are some alternate ways to store data other than a relational database? In memory databases , Hadoop/NoSQL, virtualized or “federated” databases, columnar databases, streaming databases. Why would you do that, and what are the trade-offs? Expensive hardware for in memory.
- Explain the concept of convention over configuration, and talk about an
example of convention over configuration you have seen in the wild.
Convention over configuration (also known as coding by convention) is a software design paradigm used by software frameworks that attempt to decrease the number of decisions that a developer using the framework is required to make without necessarily losing flexibility.
Example: The phrase essentially means a developer only needs to specify unconventional aspects of the application. For example, if there is a class Sales in the model, the corresponding table in the database is called “sales” by default. It is only if one deviates from this convention, such as calling the table “product sales”, that one needs to write code regarding these names.
https://en.wikipedia.org/wiki/Convention_over_configuration
- Explain the differences between stateless and stateful systems, and impacts of state on parallelism.
https://en.wikipedia.org/wiki/Stateless_protocol
A stateless protocol does not require the server to retain session information or status about each communications partner for the duration of multiple requests. In contrast, a protocol which requires keeping of the internal state on the server is known as a stateful protocol.
Example of stateless protocol HTTP
Example of statefull protocol FTP
http://stackoverflow.com/questions/5436069/what-are-the-differences- between-stateless-and-stateful-systems-and-how-do-they
A stateless system can be seen as a box [black? ;)] where at any point in time the value of the output(s) depends only on the value of the input(s) [after a certain processing time]
A stateful system instead can be seen as a box where at any point in time the value of the output(s) depends on the value of the input(s) and of an internal state, so basicaly a stateful system is like a state machine with “memory” as the same set of input(s) value can generate different output(s) depending on the previous input(s) received by the system.
From the parallel programming point of view, a stateless system, if properly implemented, can be executed by multiple threads/tasks at the same time without any concurrency issue [as an example think of a reentrant function] A stateful system will requires that multiple threads of execution access and update the internal state of the system in an exclusive way, hence there will be a need for a serialization [synchronization] point.
- Discuss the differences between Mocks and Stubs/Fakes and where you might use them (answers aren’t that important here, just the discussion that would ensue).
http://stackoverflow.com/questions/346372/whats-the-difference-between-faking-mocking-and-stubbing
Fake: a class that implements an interface but contains fixed data and no logic. Simply returns “good” or “bad” data depending on the implementation.
Mock: a class that implements an interface and allows the ability to dynamically set the values to return/exceptions to throw from particular methods and provides the ability to check if particular methods have been called/not called.
Stub: Like a mock class, except that it doesn’t provide the ability to verify that methods have been called/not called.
Mocks and stubs can be hand generated or generated by a mocking framework. Fake classes are generated by hand. I use mocks primarily to verify interactions between my class and dependent classes. I use stubs once I have verified the interactions and am testing alternate paths through my code. I use fake classes primarily to abstract out data dependencies or when mocks/stubs are too tedious to set up each time.
It is used in UnitTests
- Discuss the concept of YAGNI and explain something you did recently that adhered to this practice. https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
YAGNI a.k.a You aren’t gonna need it is a principle of extreme programming that states programmer shoul not add functionality until it is deemed necessary.
YAGNI is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing, and continuous integration
- Explain what is meant by a sandbox, why you would use one, and identify examples of sandboxes in the wild.
A sandbox is a testing environment that isolates untested code changes and outright experimentation from the production environment or repository, in the context of software development including Web development and revision control.
- Concurrency
- What’s the difference between Locking and Lockless (Optimistic and Pessimistic) concurrency models?
http://stackoverflow.com/questions/129329/optimistic-vs-pessimistic-locking
- What’s the difference between Locking and Lockless (Optimistic and Pessimistic) concurrency models?
Optimistic Locking is a strategy where you read a record, take note of a version number (other methods to do this involve dates, timestamps or checksums/hashes) and check that the version hasn’t changed before you write the record back. When you write the record back you filter the update on the version to make sure it’s atomic. (i.e. hasn’t been updated between when you check the version and write the record to the disk) and update the version in one hit.
If the record is dirty (i.e. different version to yours) you abort the transaction and the user can re-start it.
This strategy is most applicable to high-volume systems and three-tier architectures where you do not necessarily maintain a connection to the database for your session. In this situation the client cannot actually maintain database locks as the connections are taken from a pool and you may not be using the same connection from one access to the next.
Pessimistic Locking is when you lock the record for your exclusive use until you have finished with it. It has much better integrity than optimistic locking but requires you to be careful with your application design to avoid Deadlocks. To use pessimistic locking you need either a direct connection to the database (as would typically be the case in a two tier client server application) or an externally available transaction ID that can be used independently of the connection.
- What kinds of problems can you hit with locking model?
https://en.wikipedia.org/wiki/Deadlock
Deadlock.
In concurrent computing, a deadlock occurs when two competing actions wait for the other to finish, and thus neither ever does.Deadlock is a common problem in multiprocessing systems, parallel computing, and distributed systems, where software and hardware locks are used to handle shared resources and implement process synchronization.
And a lockless model?
https://en.wikipedia.org/wiki/ABA_problem
In multithreaded computing, the ABA problem occurs during synchronization, when a location is read twice, has the same value for both reads, and “value is the same” is used to indicate “nothing has changed”. However, another thread can execute between the two reads and change the value, do other work, then change the value back, thus fooling the first thread into thinking “nothing has changed” even though the second thread did work that violates that assumption.
- What trade offs do you have for resource contention?
From server level, install load balancer, from code perspective do scheduling or queueing.
- How might a task-based model differ from a threaded model?
http://stackoverflow.com/questions/20434220/threading-vs-task-based-vs-asynchronous-programming
Task-based approach refers to a specific strategy in software engineering where, in abstract terms, you dynamically create “tasks” to be accomplished, and these tasks are picked up by a task manager that assigns the tasks to threads that can accomplish them.
Threading usual refers to the simplest form of multi-threading, which is when you have a small set of threads each doing a specific task that needs to be or could benefit from running simultaneously.
- What’s the difference between asynchrony and concurrency?
http://stackoverflow.com/questions/4844637/what-is-the-difference-between-concurrency-parallelism-and-asynchronous-methods
Concurrency is having two tasks run in parallel on separate threads. However, asynchronous methods run in parallel but on the same 1 thread. - Are you still writing code? Do you love it?
- You’ve just been assigned to a project in a new technology how would you get started?
- How does the addition of Service Orientation change systems? https://msdn.microsoft.com/en-us/library/ms954826.aspx
Presented with an egg, a farmer might envision a chick; a cook might envision an omelet; and a child might envision a brightly painted Easter decoration. Service orientation is an egg.
SOAs may be realized via Web services but Web services are not necessarily required to implement SOA
Fundamental to the service model is the separation between the interface and the implementation. The invoker of a service need only (and should only) understand the interface; the implementation can evolve over time, without disturbing the clients of the service.
In Microsoft they are using WCF(Windows Communication Foundation)
When is it appropriate to use?
Http://stackoverflow.com/questions/969964/when-to-use-soa-service-oriented-architecture
We expose services to our customers because they shouldn’t be able to connect to the datasource directly.
We expose services to ourselves because it’s easier to spread them over different technologies using WCF.
We expose services because we have different user interfaces for the same datasource. And when we use services we save a third of the work.
It is never only because of the async actions.
- What do you do to stay abreast of the latest technologies and tools?
- What is the difference between “set” logic, and “procedural” logic. When would you use each one and why?
- What Source Control systems have you worked with?
TFS(If you are up to date, try to look into Atlassian product, all the software company are currently look for people who is familiar with JIRA and CONFLUENCE.
- What is Continuous Integration? https://en.wikipedia.org/wiki/Continuous_integration. Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early. Have you used it and why is it important?Check in and Check out in TFS.It is important when there are more than developers working on the same project.
- Describe a software development life cycle that you’ve managed.
- How do you react to people criticizing your code/documents?
- Whose blogs or podcasts do you follow? Do you blog or podcast?
- Tell me about some of your hobby projects that you’ve written in your off time.
- What is the last programming book you read?
- Describe, in as much detail as you think is relevant, as deeply as you can, what happens when I type “cnn.com” into a browser and press “Go”.
- Describe the structure and contents of a design document, or a set of design documents, for a multi-tiered web application.
- What’s so great about <cool web technology of the day>?
- How can you stop your DBA from making off with a list of your users’ passwords?
Using sql encryption
- What do you do when you get stuck with a problem you can’t solve?
- If your database was under a lot of strain, what are the first few things you might consider to speed it up?
- Indexing
- Increasing the memory.
- (or worse come to worse, throw the server away >P JUST KIDDING DONT BE SO SERIOUS!)
- What is SQL injection?
SQL injection is a code injection technique, used to attack data-driven applications, in which nefarious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker).
- What’s the difference between unit test and integration test?
Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation.
Integration testing (sometimes called integration and testing, abbreviated I&T) is the phase in software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before validation testing.
- Tell me about 3 times you failed.
- What is Refactoring ? Have you used it and it is important? Name three common refactorings.
https://sourcemaking.com/refactoring
Code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior.
- Rename Method
- Split temporary variable
- Subtitute algorithm
- You have two computers, and you want to get data from one to the other. How could you do it?
- Left to your own devices, what would you create?
Bot making in Telegram, blog writing and playing pokemon bot. and maybe spying the internet >P
- Given Time, Cost, Client satisfaction and Best Practices, how will you prioritize them for a project you are working on? Explain why.
- What’s the difference between a web server, web farm and web garden? How would your web application need to change for each?
WebServer
A web server is a computer system that processes requests via HTTP, the basic network protocol used to distribute information on the World Wide Web. The term can refer to the entire system, or specifically to the software that accepts and supervises the HTTP requests.
WebFarm
This is the case where you have only one web server and multiple clients requesting for resources from the same server. But when are is huge amount of incoming traffic for your web sites, one standalone server is not sufficient to process the request. You may need to use multiple servers to host the application and divide the traffic among them. This is called “Web Farm”. So when you are hosting your single web site on multiple web servers over load balancer is called “Web Farm”. The below diagram shows the overall representation of Web Farms.
Web Gardens
Now, let’s have a look at what is Web Garden? Both the terms sound the same, but they are totally different from each other. Before starting with Web Garden, I hope you have a fundamental idea of what an Application Pool is and what a Worker Process is. If you have already read the article, “How IIS Processes ASP.NET Request ?”, then I can expect that you now have a good idea about both of them.
Just to recall, when we are talking about requesting processing within IIS, Worker Process (w3wp.exe) takes care of all of these. Worker Process runs the ASP.NET application in IIS. All the ASP.NET functionality inside IIS runs under the scope of worker process. Worker Process is responsible for handling all kinds of request, response, session data, cache data. Application Pool is the container of worker process. Application pool is used to separate sets of IIS worker processes and enables a better security, reliability, and availability for any web application.
Now, by default, each and every Application pool contains a single worker process. Application which contains the multiple worker process is called “Web Garden”. Below is the typical diagram for a web garden application.
In the above diagram, you can see one of the applications containing the multiple worker processes, which is now a web garden.
So, a Web application hosted on multiple servers and access based on the load on servers is called Web Farms and when a single application pool contains multiple Worker processes, it is called a web garden.
- What value do daily builds, automated testing, and peer reviews add to a project? What disadvantages are there?
- What elements of OO design are most prone to abuse? Inheritence. How would you mitigate that? Use composition. If a class needs functionality, use composition (perhaps injecting the functionality provider into the constructor?). If a class needs TO BE like other, then use inheritance.
- When do you know your code is ready for production?
When its bug free, and written according to design patterns.
- What’s YAGNI? Is this list of questions an example?
https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
YAGNI a.k.a You aren’t gonna need it is a principle of extreme programming that states programmer shoul not add functionality until it is deemed necessary.
YAGNI is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing, and continuous integration
- Describe to me some bad code you’ve read or inherited lately.
- What is object oriented architectural style?
Object-oriented architecture is a design paradigm based on the division of responsibilities for an application or system into individual reusable and self-sufficient objects, each containing the data and the behavior relevant to the object. An object-oriented design views a system as a series of cooperating objects, instead of a set of routines or procedural instructions. Objects are discrete, independent, and loosely coupled; they communicate through interfaces, by calling methods or accessing properties in other objects, and by sending and receiving messages. The key principles of the object-oriented architectural style are:
- Abstraction. This allows you to reduce a complex operation into a generalization that retains the base characteristics of the operation. For example, an abstract interface can be a well-known definition that supports data access operations using simple methods such as Get and Update. Another form of abstraction could be metadata used to provide a mapping between two formats that hold structured data.
- Composition. Objects can be assembled from other objects, and can choose to hide these internal objects from other classes or expose them as simple interfaces.
- Inheritance. Objects can inherit from other objects, and use functionality in the base object or override it to implement new behavior. Moreover, inheritance makes maintenance and updates easier, as changes to the base object are propagated automatically to the inheriting objects.
- Encapsulation. Objects expose functionality only through methods, properties, and events, and hide the internal details such as state and variables from other objects. This makes it easier to update or replace objects, as long as their interfaces are compatible, without affecting other objects and code.
- Polymorphism. This allows you to override the behavior of a base type that supports operations in your application by implementing new types that are interchangeable with the existing object.
- Decoupling. Objects can be decoupled from the consumer by defining an abstract interface that the object implements and the consumer can understand. This allows you to provide alternative implementations without affecting consumers of the interface.
https://msdn.microsoft.com/en-us/library/ee658117.aspx#NTier3TierStyle
- What is the difference between CMMI, SCRUM, Agile methodologies?
Capability Maturity Model Integration (CMMI) is a process improvement training and appraisal program.CMMI currently addresses three areas of interest:
- Product and service development — CMMI for Development (CMMI-DEV),
- Service establishment, management, — CMMI for Services (CMMI-SVC), and
- Product and service acquisition — CMMI for Acquisition (CMMI-ACQ).
Scrum is a framework to implement the agile methodologies.