DEV Community

hdemiray
hdemiray

Posted on

Yazılımda Interface Nedir ?

Yazılımsal olarak classlara arayüz görevi görür ve classların o operasyonları imzalamasını zorunlu hale getirir.

Sürdürülebilir yazılımın en büyük üyelerindendir.
Interface'ler ile sürdürülebilir yazlımlar geliştiririz.

Projelerimizde olay insanların gündelik hayatlarıdır. Dolayısı ile gündelik hayat her gün değişkenlik gösteriyor.
Kurallar değişiyo, ihtiyaçlar değişiyor vs.

Interfaceler ile yazılımda değişim denilen süreci kolayca yönetebiliyoruz. Yani if programcılığının önüne geçiyoruz ve spagetti kodlardan kurtuluyoruz.

public static void Main()
{

    CustomerManager CustomerManager =new CustomerManager(BirinciMevzuat);
}


class CustomerManager 
{

    private IMevzuat _mevzuat;
    public CustomerManager(IMevzuat mevzuat)
    {
        _mevzuat = mevzuat
    }
    public void Add()
    {
        _mevzuat.IslemYap();
    }
}
interface IMevzuat
{
    void IslemYap();
}
class BırıncıMevzuat: IMevzuat
{
    public void IslemYap()
    {
        Console.Write("Birinci Mevzuat işlem yaptı");
    }
}
class IkinciMevzuat: IMevzuat
{
    public void IslemYap()
    {
        Console.Write("İkinci Mevzuat işlem yaptı");
    }
}
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay