DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Outside In Or Inside Out

What are the benefits to start programming from the outside in (big picture) or inside out (build around one behavior)?

David Bernstein user avatar by
David Bernstein
CORE ·
Mar. 28, 16 · Opinion
Like (3)
Save
Tweet
Share
3.87K Views

Join the DZone community and get the full member experience.

Join For Free

Most of the time when we’re building software, we’re thinking inside out. We focus on the behavior that we want to create, and build the system up from that. We do this because we’re anxious to get at the heart of the problem and solve the core issues. But there’s a problem with this approach because as we move up levels of abstraction connecting those core issues to a broader system, it can be hard to forge the right interfaces. This is inside out programming.

By contrast, outside in programming starts from the big picture, from the caller’s perspective, and drills down into the system.

One approach is not better than the other, they are both useful and valid, but we want to draw on both to build good robust systems that have strong interfaces.

Test first development is a powerful way to do outside in programming. As my associate Scott Bain likes to say, “Think of the test as your first client.” I love this statement because it really summarizes a whole range of benefits that you get from doing TDD. By writing the test first, you’re thinking from the client’s perspective, about what you want rather than how to get it, and this ripples through the design and implementation of the system, keeping it well encapsulated and easy to understand.

Sometimes we need to figure out an implementation and so we do inside out programming, but usually I want some context for an implementation so I start with the test.

Regardless of how I start, I generally want to think in both directions. How do clients want to call the service that I am about to create? And then once I call that way how can I best go about doing the task at hand?

This often reveals some intermediary steps that I want to separate out. For example, if a client wants me to process a document at a URL that it passes me I should separate out the retrieval of the document from the processing because by doing so, I make both steps far more testable and easier to integrate.

It’s generally advisable to separate out perspective in code regardless of what they are. The UML calls out three perspectives in code that are good to separate out. These are the conceptual, the specification, and the implementation perspectives.

The conceptual perspective shows what we want but not how to get it. This typically maps to abstractions or interfaces in code.

The specification perspective shows how the different entities communicate with each other in order to accomplish their tasks. This maps to method signatures that determine how methods are evoked and what they return.

Finally, the implementation perspective is the code itself.

It’s a good idea to separate these perspectives out when building software, and in fact if we look at the twenty-three design patterns from the Gang of Four we would notice that by and large these three perspectives are separated out, and this is one of the reasons patterns are so useful and so easily maintainable.

Implementation Testing Interface (computing) Abstraction (computer science) IT Document Design Task (computing)

Published at DZone with permission of David Bernstein, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Steel Threads Are a Technique That Will Make You a Better Engineer
  • Multi-Cloud Integration
  • How To Choose the Right Streaming Database
  • 5 Software Developer Competencies: How To Recognize a Good Programmer

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: