dasari4kntr Posted March 13 Report Posted March 13 రెండు interviews..లో ఇద్దరిని అడిగితే …ఇద్దరూ నీళ్ళు నమిలారు… Quote
NaniVuncle Posted March 13 Report Posted March 13 Just now, dasari4kntr said: రెండు interviews..లో ఇద్దరిని అడిగితే …ఇద్దరూ నీళ్ళు నమిలారు… PM requirement here Quote
EggpuffReddy Posted March 13 Report Posted March 13 3 minutes ago, dasari4kntr said: రెండు interviews..లో ఇద్దరిని అడిగితే …ఇద్దరూ నీళ్ళు నమిలారు… this is the chatGPT answer, ila chebte oknaa, next follow up questions em vuntaayi Great! Let's go over the SOLID principles, which are 5 key design principles in object-oriented programming (OOP) to make software more maintainable, flexible, and scalable. The acronym SOLID stands for: ✅ S — Single Responsibility Principle (SRP) "A class should have only one reason to change." Each class or module should focus on one task or responsibility. Benefits: Easier to maintain, test, and understand. Example: csharp CopyEdit // ❌ Bad: Mixing responsibilities class Report { void GenerateReport() { ... } void SaveToFile() { ... } // Saving is not report generation } // ✅ Good: Separate responsibilities class Report { void GenerateReport() { ... } } class FileSaver { void SaveToFile(Report report) { ... } } ✅ O — Open/Closed Principle (OCP) "Software entities should be open for extension, but closed for modification." You should be able to extend a class's behavior without modifying its source code. Benefits: Easy to add new features without breaking existing code. Example: csharp CopyEdit // Base class abstract class Shape { public abstract double GetArea(); } // Extension via inheritance class Circle : Shape { public override double GetArea() { ... } } class Rectangle : Shape { public override double GetArea() { ... } } ✅ L — Liskov Substitution Principle (LSP) "Derived classes must be substitutable for their base classes." A subclass should be able to replace its parent class without breaking functionality. Benefits: Ensures consistent behavior when using base types. Example: csharp CopyEdit class Bird { public virtual void Fly() { ... } } class Sparrow : Bird { public override void Fly() { ... } } // ✅ Violating this would be making a Penguin class extend Bird and try to Fly, which it can't. ✅ I — Interface Segregation Principle (ISP) "Clients should not be forced to depend on interfaces they do not use." Many small, specific interfaces are better than a large, general-purpose one. Benefits: Avoids forcing classes to implement unnecessary methods. Example: csharp CopyEdit // ❌ Bad: One big interface interface IMachine { void Print(); void Scan(); void Fax(); } // ✅ Good: Segregate interfaces interface IPrinter { void Print(); } interface IScanner { void Scan(); } // Class only implements what it needs class Printer : IPrinter { public void Print() { ... } } ✅ D — Dependency Inversion Principle (DIP) "Depend on abstractions, not on concretions." High-level modules should not depend on low-level modules, but both should depend on abstractions (interfaces). Benefits: Makes code flexible and reduces coupling. Example: csharp CopyEdit // Interface interface IMessageSender { void SendMessage(string message); } // Concrete implementation class EmailSender : IMessageSender { public void SendMessage(string message) { ... } } // High-level class depending on abstraction class NotificationService { private readonly IMessageSender _sender; public NotificationService(IMessageSender sender) { _sender = sender; } public void Notify(string message) { _sender.SendMessage(message); } } ✅ Summary of SOLID: Principle Description Goal S - Single Responsibility One class = one job Low coupling, high cohesion O - Open/Closed Open for extension, closed for modification Extensible and stable code L - Liskov Substitution Subtypes replace base types without issues Reliable polymorphism I - Interface Segregation Many specific interfaces > one large one Avoid bloated interfaces D - Dependency Inversion Depend on abstractions, not concretions Flexible, testable, maintainable code Quote
*Prince Charming Posted March 13 Report Posted March 13 10 minutes ago, dasari4kntr said: రెండు interviews..లో ఇద్దరిని అడిగితే …ఇద్దరూ నీళ్ళు నమిలారు… SOLID principles kakunda inkem telsikovaali ?? For interviews?? Quote
Popular Post Spartan Posted March 13 Popular Post Report Posted March 13 frankly....interviews ki tappa...real world daily work lo does anyone even care about these anna.. SOLID, ACID... etc vatillo unna concepts over the period experience to ostai....but desining or coding appudu I havent seen anyone bring this up and adhere to them.. unless someone wants to play Devils Advocate during the session.... @Konebhar6 @dasari4kntr @csrcsr 8 Quote
Aquaman Posted March 13 Report Posted March 13 11 minutes ago, Spartan said: frankly....interviews ki tappa...real world daily work lo does anyone even care about these anna.. SOLID, ACID... etc vatillo unna concepts over the period experience to ostai....but desining or coding appudu I havent seen anyone bring this up and adhere to them.. unless someone wants to play Devils Advocate during the session.... @Konebhar6 @dasari4kntr @csrcsr code reviews lo chustam anna Quote
Spartan Posted March 13 Report Posted March 13 Just now, Aquaman said: code reviews lo chustam anna LGTM. 2 Quote
dasari4kntr Posted March 13 Author Report Posted March 13 41 minutes ago, EggpuffReddy said: this is the chatGPT answer, ila chebte oknaa, next follow up questions em vuntaayi Great! Let's go over the SOLID principles, which are 5 key design principles in object-oriented programming (OOP) to make software more maintainable, flexible, and scalable. The acronym SOLID stands for: ✅ S — Single Responsibility Principle (SRP) "A class should have only one reason to change." Each class or module should focus on one task or responsibility. Benefits: Easier to maintain, test, and understand. Example: csharp CopyEdit // ❌ Bad: Mixing responsibilities class Report { void GenerateReport() { ... } void SaveToFile() { ... } // Saving is not report generation } // ✅ Good: Separate responsibilities class Report { void GenerateReport() { ... } } class FileSaver { void SaveToFile(Report report) { ... } } ✅ O — Open/Closed Principle (OCP) "Software entities should be open for extension, but closed for modification." You should be able to extend a class's behavior without modifying its source code. Benefits: Easy to add new features without breaking existing code. Example: csharp CopyEdit // Base class abstract class Shape { public abstract double GetArea(); } // Extension via inheritance class Circle : Shape { public override double GetArea() { ... } } class Rectangle : Shape { public override double GetArea() { ... } } ✅ L — Liskov Substitution Principle (LSP) "Derived classes must be substitutable for their base classes." A subclass should be able to replace its parent class without breaking functionality. Benefits: Ensures consistent behavior when using base types. Example: csharp CopyEdit class Bird { public virtual void Fly() { ... } } class Sparrow : Bird { public override void Fly() { ... } } // ✅ Violating this would be making a Penguin class extend Bird and try to Fly, which it can't. ✅ I — Interface Segregation Principle (ISP) "Clients should not be forced to depend on interfaces they do not use." Many small, specific interfaces are better than a large, general-purpose one. Benefits: Avoids forcing classes to implement unnecessary methods. Example: csharp CopyEdit // ❌ Bad: One big interface interface IMachine { void Print(); void Scan(); void Fax(); } // ✅ Good: Segregate interfaces interface IPrinter { void Print(); } interface IScanner { void Scan(); } // Class only implements what it needs class Printer : IPrinter { public void Print() { ... } } ✅ D — Dependency Inversion Principle (DIP) "Depend on abstractions, not on concretions." High-level modules should not depend on low-level modules, but both should depend on abstractions (interfaces). Benefits: Makes code flexible and reduces coupling. Example: csharp CopyEdit // Interface interface IMessageSender { void SendMessage(string message); } // Concrete implementation class EmailSender : IMessageSender { public void SendMessage(string message) { ... } } // High-level class depending on abstraction class NotificationService { private readonly IMessageSender _sender; public NotificationService(IMessageSender sender) { _sender = sender; } public void Notify(string message) { _sender.SendMessage(message); } } ✅ Summary of SOLID: Principle Description Goal S - Single Responsibility One class = one job Low coupling, high cohesion O - Open/Closed Open for extension, closed for modification Extensible and stable code L - Liskov Substitution Subtypes replace base types without issues Reliable polymorphism I - Interface Segregation Many specific interfaces > one large one Avoid bloated interfaces D - Dependency Inversion Depend on abstractions, not concretions Flexible, testable, maintainable code next ఆ dependecy invesion గురించి questions పడతాయి… Quote
dasari4kntr Posted March 13 Author Report Posted March 13 36 minutes ago, Spartan said: frankly....interviews ki tappa...real world daily work lo does anyone even care about these anna.. SOLID, ACID... etc vatillo unna concepts over the period experience to ostai....but desining or coding appudu I havent seen anyone bring this up and adhere to them.. unless someone wants to play Devils Advocate during the session.... @Konebhar6 @dasari4kntr @csrcsr solid …very important… if someone knows…solid …they know the dependency injection….and next they kbow how it is useful in unit tests… 1 Quote
dasari4kntr Posted March 13 Author Report Posted March 13 38 minutes ago, Spartan said: frankly....interviews ki tappa...real world daily work lo does anyone even care about these anna.. SOLID, ACID... etc vatillo unna concepts over the period experience to ostai....but desining or coding appudu I havent seen anyone bring this up and adhere to them.. unless someone wants to play Devils Advocate during the session.... @Konebhar6 @dasari4kntr @csrcsr simple example…springboot లో ప్రతి class లో @Autowired అని రాస్తాం…అది ఎందుకు అంటే…దానికి ఆది మూలం ఇదే… Quote
dasari4kntr Posted March 13 Author Report Posted March 13 56 minutes ago, *Prince Charming said: SOLID principles kakunda inkem telsikovaali ?? For interviews?? developer role కాబట్టి …అక్కడ నుండి start చేసా…next…oka coding problem ఇచ్చి execute చేయమంటా…to see he is hands on or not… Quote
Mr Mirchi Posted March 13 Report Posted March 13 1 hour ago, dasari4kntr said: రెండు interviews..లో ఇద్దరిని అడిగితే …ఇద్దరూ నీళ్ళు నమిలారు… Kanikaram ledhu e khatina manavudiki 2 Quote
Mr Mirchi Posted March 13 Report Posted March 13 59 minutes ago, Spartan said: frankly....interviews ki tappa...real world daily work lo does anyone even care about these anna.. SOLID, ACID... etc vatillo unna concepts over the period experience to ostai....but desining or coding appudu I havent seen anyone bring this up and adhere to them.. unless someone wants to play Devils Advocate during the session.... @Konebhar6 @dasari4kntr @csrcsr Acid yes…. Solid jujubi mostly intervieer thana pethapam chupimchalante aduguthadu ilantivi .. kondharu ithe java lantivi ok but thuppasi vatiki kuda VERSIONS adugutharu Quote
dasari4kntr Posted March 13 Author Report Posted March 13 sare.. @Spartan @Mr Mirchi...ee code ki unit test ela raastro.. cheppandi.... class OrderService { private final SqlDatabase database; private final FileLogger logger; public OrderService() { this.database = new SqlDatabase(); this.logger = new FileLogger(); } public void processOrder(Order order) { try { database.save(order); logger.log("Order processed: " + order.getId()); } catch (Exception e) { logger.log("Error processing order: " + e.getMessage()); } } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.