Articles contributed by the community, curated for your enjoyment and reading.
Filters
ResetIoC Container and Lifetime Management
Understanding Inversion of Control (IoC) Container and Lifetime Management in ASP.NET Core In modern software development, the Inversion of Control (IoC) pattern has become a fundamental principle for building scalable and maintainable applications. The IoC pattern promotes loose coupling between classes by allowing the control of object creation and dependency resolution to be inverted or delegated to a container. In the context of ASP.NET Core, the IoC container is a core component that manages the lifetime and resolution of dependencies, making it easier to manage application dependencies and promote modular design. In this blog post, we will explore the concept of the IoC container and understand the different dependency lifetimes supported by ASP.NET Core, accompanied by relevant code examples. What is an IoC Container? At its core, an IoC container is a tool that automates the process of managing object creation and dependency resolution in an application. It is responsible for instantiating objects and resolving their dependencies, removing the burden from the application code. By using an IoC container, classes can be decoupled from their dependencies, leading to more modular and testable code. In ASP.NET Core, the built-in IoC container is based on the Microsoft.Extensions.DependencyInjection library. It is a lightweight, extensible, and feature-rich container that simplifies the management of application dependencies. Dependency Lifetimes in ASP.NET Core When registering services with the IoC container, you can specify different dependency lifetimes. The dependency lifetime defines how long an object (service) should exist within the container and when a new instance should be created. ASP.NET Core supports three main dependency lifetimes: Transient: A new instance of the service is created every time it is requested from the container. Transient lifetime is suitable for lightweight, stateless services. Scoped: A single instance of the service is created per HTTP request or service scope. Within the same HTTP request or service scope, the same instance is reused. Scoped lifetime is suitable for services that maintain state across multiple related operations within the same request. Singleton: A single instance of the service is created and shared across the entire application. The same instance is reused for every request. Singleton lifetime is suitable for services that are stateless or should maintain global state throughout the application’s lifetime. Example: Registering Services with Dependency Lifetimes Let’s look at a practical example of registering services with different dependency lifetimes in an ASP.NET Core application: // Startup.cs using Microsoft.Extensions.DependencyInjection; public class Startup { public void ConfigureServices(IServiceCollection services) { // Transient lifetime - A new instance is created each time it's requested. services.AddTransient<IMyTransientService, MyTransientService>(); // Scoped lifetime - A single instance is created per HTTP request or service scope. services.AddScoped<IMyScopedService, MyScopedService>(); // Singleton lifetime - A single instance is created and shared across the application. services.AddSingleton<IMySingletonService, MySingletonService>(); } } In this example, we have registered three services with different dependency lifetimes. Now, let’s define these services: // Services public interface IMyTransientService { string GetInstanceId(); } public class MyTransientService : IMyTransientService { private readonly Guid _instanceId; public MyTransientService() { _instanceId = Guid.NewGuid(); } public string GetInstanceId() { return _instanceId.ToString(); } } public interface IMyScopedService { string GetInstanceId(); } public class MyScopedService : IMyScopedService { private readonly Guid _instanceId; public MyScopedService() { _instanceId = Guid.NewGuid(); } public string GetInstanceId() { return _instanceId.ToString(); } } public interface IMySingletonService { string GetInstanceId(); } public class MySingletonService : IMySingletonService { private readonly Guid _instanceId; public MySingletonService() { _instanceId = Guid.NewGuid(); } public string GetInstanceId() { return _instanceId.ToString(); } } In this example, we have defined three services: MyTransientService, MyScopedService, and MySingletonService, each implementing their respective interfaces. Each service has a unique identifier generated during its instantiation. Using Services with Different Dependency Lifetimes Now, let’s use these services in a controller to observe how their dependency lifetimes behave: // MyController.cs using Microsoft.AspNetCore.Mvc; [Route("api/[controller]")] [ApiController] public class MyController : ControllerBase { private readonly IMyTransientService _transientService; private readonly IMyScopedService _scopedService; private readonly IMySingletonService _singletonService; public MyController( IMyTransientService transientService, IMyScopedService scopedService, IMySingletonService singletonService) { _transientService = transientService; _scopedService = scopedService; _singletonService = singletonService; } [HttpGet] public IActionResult Get() { var result = new { TransientInstanceId = _transientService.GetInstanceId(), ScopedInstanceId = _scopedService.GetInstanceId(), SingletonInstanceId = _singletonService.GetInstanceId() }; return Ok(result); } } In this controller, we inject the three services as constructor parameters. We then call the GetInstanceId() method on each service and return the unique instance IDs in the HTTP response. Conclusion Understanding the concept of an IoC container and the different dependency lifetimes in ASP.NET Core is crucial for building modular and maintainable applications. By leveraging the IoC container, you can achieve loose coupling, improve testability, and promote good software design practices. Utilizing the appropriate dependency lifetime for each service ensures that your application performs efficiently and meets the requirements of different scenarios. In this blog post, we explored the IoC container and the three main dependency lifetimes supported by ASP.NET Core. By applying these concepts and principles in your projects, you can create robust, scalable, and maintainable software solutions. Remember, the IoC container is an indispensable tool in the arsenal of every software developer, enabling them to write cleaner, more modular code that is easier to maintain and extend. Embrace the IoC pattern, harness the power of the ASP.NET Core IoC container, and elevate your software development journey to new heights! Please find original article here, IoC Container and Lifetime Management
Understanding Dependency Injection: A Practical Guide with Code Examples
Dependency Injection (DI) is a powerful software design pattern widely used in modern application development, including ASP.NET Core. It helps manage the complexity of large-scale applications by promoting loose coupling and increasing testability and maintainability. In this blog post, we will explore the concept of Dependency Injection, understand its benefits, and demonstrate how to implement DI in an ASP.NET Core application with relevant code examples. What is Dependency Injection? Dependency Injection is a design pattern that allows components to depend on abstractions (interfaces) rather than concrete implementations. It enables the separation of concerns, making the code more modular and flexible. In the context of ASP.NET Core, DI enables the injection of required services (dependencies) into classes rather than creating them directly within the class. Benefits of Dependency Injection: Decoupling: DI promotes loose coupling between classes, making it easier to change or replace dependencies without affecting other parts of the application. Testability: With DI, it becomes straightforward to replace real dependencies with mock implementations during unit testing, enabling isolated and more reliable tests. Reusability: By using interfaces and abstractions, components become more reusable across different parts of the application. Maintainability: DI enhances code maintainability by breaking down complex components into smaller, focused classes with clear responsibilities. Flexibility: It allows runtime configuration of dependencies, facilitating easy switch between different implementations, such as in different environments (development, production). Dependency Injection (DI) can be categorized into three main types: Constructor Injection: Constructor Injection is the most common and recommended type of DI. In this type, dependencies are injected into a class through its constructor. The class declares its dependencies as constructor parameters, and the DI container provides the appropriate implementations when creating instances of the class. This promotes a clear and explicit declaration of dependencies, making the class easier to understand and test. Example of Constructor Injection: public class ProductService : IProductService { private readonly IProductRepository _productRepository; // Constructor Injection - The IProductRepository dependency is injected into ProductService. public ProductService(IProductRepository productRepository) { _productRepository = productRepository; } // Other methods... } Property Injection: In Property Injection, dependencies are set using public properties of the class. The DI container sets the property values after creating the instance of the class. Property Injection is less preferred compared to Constructor Injection because it hides the class’s dependencies and makes it less clear which dependencies are required. Example of Property Injection: public class ProductService : IProductService { // Property Injection - The IProductRepository dependency is set using a public property. public IProductRepository ProductRepository { get; set; } // Other methods... } Method Injection: Method Injection involves passing dependencies to a method as parameters. This type of DI is used when a class needs a dependency only for a specific method and not throughout its lifetime. Method Injection is less common and typically used in scenarios where a specific method requires additional dependencies not used by other methods in the class. Example of Method Injection: public class ProductService : IProductService { // Method Injection - The IProductRepository dependency is passed as a parameter. public void ProcessProduct(IProductRepository productRepository) { // Method logic using the provided productRepository... } // Other methods... } It’s essential to choose the appropriate DI type based on the specific needs of your application. Constructor Injection is generally recommended due to its explicit declaration of dependencies and ease of testing. Property Injection and Method Injection is useful in certain scenarios but should be used with caution to maintain code readability and avoid potential pitfalls. Implementing Dependency Injection in ASP.NET Core: Let’s walk through an example of implementing DI in an ASP.NET Core application with the following project structure: ├── src │ ├── Core # Contains the core business logic and domain models │ ├── Infrastructure # Contains infrastructure concerns such as data access, external services │ └── UI # Contains the user interface layer, including controllers, views, etc. 1. Define Interfaces: In the Core project, create interfaces for services that will be injected into other classes. For example, IProductService and IProductRepository. // IProductService.cs public interface IProductService { Task<IEnumerable<ProductViewModel>> GetProducts(); // Other methods... } // IProductRepository.cs public interface IProductRepository { Task<IEnumerable<Product>> GetAll(); // Other methods... } 2. Implement Services and Repositories: In the Infrastructure project, implement the services and repositories defined in the Core project. // ProductService.cs public class ProductService : IProductService { private readonly IProductRepository _productRepository; public ProductService(IProductRepository productRepository) { _productRepository = productRepository; } public async Task<IEnumerable<ProductViewModel>> GetProducts() { var products = await _productRepository.GetAll(); // Map and return view models... } // Other methods... } // ProductRepository.cs public class ProductRepository : IProductRepository { private readonly ApplicationDbContext _dbContext; public ProductRepository(ApplicationDbContext dbContext) { _dbContext = dbContext; } public async Task<IEnumerable<Product>> GetAll() { return await _dbContext.Products.ToListAsync(); } // Other methods... } 3. Register Services in Startup: In the Startup.cs file of the UI the project, configure DI by registering services. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddScoped<IProductService, ProductService>(); services.AddScoped<IProductRepository, ProductRepository>(); // Other service registrations... services.AddControllersWithViews(); } 4. Utilize Dependency Injection: Finally, utilize DI in the controllers or other classes that require the services. public class ProductController : Controller { private readonly IProductService _productService; public ProductController(IProductService productService) { _productService = productService; } public async Task<IActionResult> Index() { var products = await _productService.GetProducts(); return View(products); } // Other actions... } Conclusion: Dependency Injection is a crucial aspect of building scalable and maintainable applications. In ASP.NET Core, it allows for the decoupling of components, increases testability, and enhances code maintainability. By utilizing interfaces and registering services in the Startup class, we can easily implement DI in our projects. This approach helps to achieve a clean, organized, and robust architecture that is highly beneficial for long-term project success. Implementing DI in your projects can lead to more maintainable, testable, and flexible applications, allowing you to focus on delivering value to your users while maintaining a high level of code quality. Note: This article has been written by Kawser Hamid and republished on MudMatter with Author’s Permission. Please find the original link here – Understanding Dependency Injection: A Practical Guide with Code Examples.
Pesto Pizza with Fresh Tomatoes & Mozzarella
Loaded with basil pesto, fresh tomatoes and mozzarella, pesto pizza is the ultimate summer pizza. To me, a good pesto pizza should have bold pesto flavor. I don’t want it to taste faintly of basil, garlic, Parmesan and olive oil—I want those flavors to bowl me over. The key is to spread a generous layer of pesto over the pizzas before baking, and then top them with more pesto when they come out of the oven. Not only do these pizzas taste very “pesto-y,” they also look gorgeous and feel a little more special than your typical pizza pie. I’ve given instructions for homemade pizza dough below but don’t feel obligated to make it; store-bought pizza dough works beautifully and makes this recipe totally doable on a weeknight. Same goes for the pesto — if you want to make it from scratch, use this recipe, but store-bought works well, too (I like Mama’s pesto from Whole Foods). What you’ll need To Make Pesto Pizza With Fresh Tomatoes & Mozzarella For The Pizza Dough For the Toppings How to make Pesto Pizza with Fresh Tomatoes & Mozzarella Step 1: Make the Dough In a mixer fitted with the dough hook (or a large bowl if you’d like to make it by hand), combine the flour, yeast, salt, olive oil, and water. Mix until the dough comes together. Increase the speed and knead for about 5 minutes, until the dough is smooth and elastic. Flour your hands if necessary, and transfer the dough to a lightly oiled large bowl. Cover with plastic wrap and let rise in a warm place until doubled in size, 1 to 1-1/2 hours. When the dough has risen, punch it down. Place the dough on a lightly floured surface. Cut it in half and roll each part into a ball. Cover the dough balls with a damp kitchen towel and let rest for 15 to 20 minutes — the dough will rise a bit. Lightly dust a work surface with flour, and then pat and stretch the rested dough into two 12×8-inch rectangles. If the dough is sticky, dust it lightly with flour. Place the two pizza doughs side-by-side on the prepared baking sheet. Then press the dough out again so that it almost touches the edges of the pan. Step 2: Assemble and Bake the Pizzas Cut the tomatoes crosswise into 1/8-inch-thick slices and place on a paper towel-lined plate or cutting board to drain the juices. Spread 1/3 cup of the pesto evenly over the pizzas, leaving a 1-inch border. Bake the pizzas on the bottom rack for 4 minutes. (I do this so the crust has time to crisp up; if you add the cheese from the get-go, it gets too brown before the crust is fully cooked.) Remove the pan from the oven; and then top the pizzas with the mozzarella cheese, followed by the tomato slices, Parmigiano-Reggiano, salt and pepper. Place the pizzas back in the oven and bake until the crust is crisp and golden, 6 to 8 minutes more. Transfer the pizzas to a cutting board and drizzle with the with remaining pesto. Sprinkle with fresh basil, then cut into slices and serve. Enjoy! Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Pesto Pizza with Fresh Tomatoes & Mozzarella.
Mastering SOLID Design Principles: A Blueprint for Clean Code
Introduction: In the dynamic world of software development, writing maintainable and scalable code is crucial to the success of any project. SOLID design principles provide a set of guidelines that can help developers achieve precisely that. Developed by Robert C. Martin (Uncle Bob), these principles have become a cornerstone of modern software architecture. In this blog post, we will dive deep into each SOLID principle, understand its significance, and learn how to apply them with practical coding examples. 1. Single Responsibility Principle (SRP): The Single Responsibility Principle states that a class should have only one reason to change. In other words, a class should have a single responsibility or task. Let’s see how we can apply this principle to a sample application. // Bad Practice - One class with multiple responsibilities class OrderProcessingService { public void ProcessOrder(Order order) { // ... Process the order ... } public void SendEmailConfirmation(Order order) { // ... Send email confirmation ... } public void GenerateInvoice(Order order) { // ... Generate the invoice ... } } // Good Practice - Separate classes with single responsibility class OrderProcessor { public void ProcessOrder(Order order) { // ... Process the order ... } } class EmailService { public void SendEmailConfirmation(Order order) { // ... Send email confirmation ... } } class InvoiceGenerator { public void GenerateInvoice(Order order) { // ... Generate the invoice ... } } By following SRP, we ensure that each class has a clear purpose, making the code more modular, maintainable, and easier to understand. 2. Open-Closed Principle (OCP): The Open-Closed Principle suggests that software entities should be open for extension but closed for modification. This means we should be able to extend the behavior of a class without modifying its existing code. Let’s explore how we can implement this principle. // Bad Practice - Modifying existing class class Shape { public virtual double Area() { // ... Calculate area ... } } class Circle : Shape { public override double Area() { // ... Calculate circle area ... } } class Square : Shape { public override double Area() { // ... Calculate square area ... } } // Good Practice - Extending behavior through interfaces interface IShape { double Area(); } class Circle : IShape { public double Area() { // ... Calculate circle area ... } } class Square : IShape { public double Area() { // ... Calculate square area ... } } By using interfaces, we adhere to OCP and create more flexible and adaptable systems that can be easily extended without altering existing code. 3. Liskov Substitution Principle (LSP): The Liskov Substitution Principle emphasizes that objects of derived classes should be substitutable for objects of the base class without affecting program correctness. Let’s see how we can maintain LSP. // Bad Practice - Violating LSP class Bird { public virtual void Fly() { // ... Fly like a bird ... } } class Penguin : Bird { public override void Fly() { throw new NotSupportedException("Penguins cannot fly."); } } // Good Practice - Upholding LSP interface IFlyable { void Fly(); } class Bird : IFlyable { public void Fly() { // ... Fly like a bird ... } } class Penguin : IFlyable { public void Fly() { // Penguins cannot fly, but still conform to the interface. } } By following LSP, we ensure that derived classes can seamlessly replace their base class counterparts, promoting code consistency and maintainability. 4. Interface Segregation Principle (ISP): The Interface Segregation Principle advises segregating interfaces into smaller, focused ones, rather than having large, monolithic interfaces. This promotes a more granular and concise design. Let’s see how to implement ISP. // Bad Practice - Large, monolithic interface interface IWorker { void Work(); void Eat(); void Sleep(); } class Robot : IWorker { // Implementing unnecessary methods for a robot. } class Human : IWorker { // Implementing unnecessary methods for a human. } // Good Practice - Segregated interfaces interface IWorkable { void Work(); } interface IEatable { void Eat(); } interface ISleepable { void Sleep(); } class Robot : IWorkable { public void Work() { // ... Robot work logic ... } } class Human : IWorkable, IEatable, ISleepable { public void Work() { // ... Human work logic ... } public void Eat() { // ... Human eat logic ... } public void Sleep() { // ... Human sleep logic ... } } By adhering to ISP, we create leaner and more focused interfaces, enabling better code maintainability and adaptability. 5. Dependency Inversion Principle (DIP): The Dependency Inversion Principle suggests relying on abstractions rather than concrete implementations. High-level modules should not depend on low-level modules; both should depend on abstractions. Let’s apply DIP. // Bad Practice - High-level module depends on low-level module class OrderProcessor { private readonly EmailService _emailService; public OrderProcessor() { _emailService = new EmailService(); } public void ProcessOrder(Order order) { // ... Process the order ... _emailService.SendEmailConfirmation(order); } } // Good Practice - High-level module depends on abstraction interface IEmailService { void SendEmailConfirmation(Order order); } class EmailService : IEmailService { public void SendEmailConfirmation(Order order) { // ... Send email confirmation ... } } class OrderProcessor { private readonly IEmailService _emailService; public OrderProcessor(IEmailService emailService) { _emailService = emailService; } public void ProcessOrder(Order order) { // ... Process the order ... _emailService.SendEmailConfirmation(order); } } By following DIP, we promote loose coupling and enable easier testing, extensibility, and a more modular design. Conclusion: Incorporating SOLID principles in your software development journey can be transformational. These principles empower developers to write cleaner, more maintainable, and extensible code, which results in robust and scalable software solutions. As you apply SRP, OCP, LSP, ISP, and DIP in your projects, you’ll witness the growth of your coding prowess and the emergence of truly clean code that stands the test of time. Embrace SOLID principles and elevate your coding skills to new heights! Note: This article has been written by Kawser Hamid and republished on MudMatter with Author’s Permission. Please find the original link here – Mastering SOLID Design Principles: A Blueprint for Clean Code.
Spring Risotto with Asparagus & Peas
This creamy risotto with asparagus and peas makes a lovely starter, side dish, or vegetarian main course for spring. Comforting to eat — and comforting to make, in a mindless, repetitive sort of way — risotto is a northern Italian rice dish cooked gently until it reaches a creamy consistency. Most people think of it as a restaurant-style dish, but it’s actually quite simple to make with just a few ingredients. The only thing to keep in mind is that it requires frequent stirring, so you need to stay close to the stove for 25 minutes while it cooks. This spring risotto calls for seasonal vegetables but there’s lots of room for creativity and improvisation. Don’t feel like asparagus? Substitute zucchini or mushrooms. Going vegetarian? Replace the chicken broth with vegetable broth. Want to fancy it up? Stir in some fresh herbs at the end. You really can’t go wrong as long as you stick to the basic formula. Serve this spring risotto as a meatless main course or as a side to a simply cooked main dish, like pan-seared salmon or perfectly grilled chicken breasts. How To Make Spring Risotto with Asparagus & Peas Before we get to the step-by-step instructions, a few words about the ingredients: All risotto recipes begin with Arborio rice, a short-grained, high-starch Italian rice that becomes creamy and slightly chewy when cooked. You can find it in the rice section of most supermarkets. White wine is a key ingredient in risotto, as it adds nice depth of flavor. However, if you’d prefer not use it, replace it with more broth and add a squeeze of lemon at the end. It’s important to use low-sodium broth when making risotto. The broth reduces while it cooks, intensifying the saltiness. Step-by Step Instructions The first step to cooking risotto is to bring your broth to a simmer. It’s important that the broth is hot before you add it to the rice, as cold broth will cool the pan down and slow the cooking process. While the broth heats up, melt the butter in a large pot or Dutch oven (it’s important to use a large cooking vessel, as the rice will increase in volume when cooked). Add the asparagus and cook until tender-crisp, a few minutes. Add the peas and cook for 1 minute more, until they are defrosted. Transfer the vegetables to a plate and set aside. You’ll add them back to the risotto at the very end. Cooking the vegetables first ensures that they don’t overcook. In the same pot over medium-low heat, melt 2 tablespoons of the butter and add the onions. Cook, stirring frequently, until translucent, 2 to 3 minutes. Then, add the garlic and cook for 1 minute more. Do not brown. Add the Arborio rice to the onions and garlic. Cook, stirring constantly, until glossy and translucent around the edges, about 3 minutes. This step of toasting the rice in fat adds depth of flavor and also prevents the grains from becoming mushy during the cooking process. Add the wine and cook until completely absorbed, about 1 minute. Ladle about 1 cup of the simmering broth into the rice. Cook, stirring occasionally, until absorbed. Continue adding the broth, 1 cup at a time and stirring until it is absorbed, until the rice is tender, about 25 minutes. You don’t need to stir constantly; just check on it every few minutes to stir and prevent sticking. You’ll know it’s done when the rice al dente — just cooked, still with a little bite to it. Add the reserved vegetables, Parmigiano-Reggiano, and remaining tablespoon of butter to the risotto. Stir, then taste and adjust seasoning with salt and pepper, if necessary. If the risotto is too thick, thin it with a bit of milk. Spoon into bowls and serve with more cheese. If you have leftover risotto, I highly recommend making risotto cakes. They are quite possibly even better than the actual risotto! You don’t need a recipe: simply mix the leftover cold risotto with a generous handful of shredded cheese. Use a cheese that melts well, such as fontina, Cheddar, Gruyère, or mozzarella. Scoop up about 1/3 cup of the risotto at a time and shape into patties about 3/4 inch thick and 3 inches wide. Coat the risotto cakes in panko, then fry in olive oil over medium heat until golden and crisp, about 3 minutes per side. Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Spring Risotto with Asparagus & Peas.
Pad Thai
Craving restaurant-quality pad Thai? Using easy-to-find ingredients and this simple recipe, you can make it at home! Pad Thai is a popular stir-fried noodle dish that originated in Thailand, where it’s commonly enjoyed as a quick and easy street food. Today, it’s a popular Thai restaurant dish in many parts of the world. If you love this noodle dish as much as I do, you’ll be pleased to know that it’s surprisingly easy to make in your own kitchen. While traditional pad Thai calls for a daunting list of hard-to-find ingredients, from tamarind liquid and dried shrimp to pickled white radishes and garlic chives, a simplified “Westernized” version can be just as delicious with a few ingredient substitutions (yes, that’s why the recipe strangely calls for ketchup!). Pad Thai is made with rice noodles, which can usually be found in the Asian or Thai food section of most large supermarkets. It’s important to note that the process of cooking rice noodles is different from cooking other types of pasta. To start, fill a pot with water and bring it to a boil. Once boiling, remove the pot from the heat and add the rice noodles. Allow them to soak in the hot water for 5 to 10 minutes, or until they become tender yet still chewy. Once done, drain the noodles in a colander and rinse them briefly under cold water to remove any excess starch. From there, it’s just a matter of stir-frying the noodles with the other pad Thai ingredients. What you’ll need to make pad thai Step-by-Step Instructions Step 1: Soak the Rice Noodles Bring a large pot or wide skillet of water to a boil. Off the heat, add the noodles. Briefly swish them around to separate them, then let sit, stirring occasionally to prevent sticking, until the noodles are soft and pliable but still not tender, 5 to 10 minutes. Drain and rinse well with cold water. Set aside. Step 2: Cook the Pad Thai In a small bowl, beat the eggs with a pinch of salt. Set aside. Make the sauce: In a medium bowl, whisk together the water, fish sauce, soy sauce, vinegar, ketchup, sugar, and red pepper flakes. Set aside. Heat 2 tablespoons of the oil in a large nonstick pan or wok over medium-high heat. Add the shrimp and season with ⅛ teaspoon salt. Cook, stirring often, for two minutes. Add the garlic and light green scallions and cook, stirring constantly, until softened and the shrimp are cooked through, about 1 minute more. Transfer the shrimp, garlic, and scallions to a large plate, using a rubber spatula to scrape the pan clean. To the pan, add 1 teaspoon of oil to the hot pan. Add the eggs and scramble until cooked through, 1 to 2 minutes. Transfer the eggs to the plate with the shrimp. Add 2 tablespoons of oil to the hot pan. Place the drained noodles in the pan, along with the sauce mixture. Cook, tossing the noodles gently so as not to break them, until the liquid is absorbed by the noodles and the noodles are cooked through, a few minutes. If the noodles are still firm to the bite when the sauce is absorbed, add a few tablespoons of water and continue cooking. Add the contents of the plate and the dark green scallions to the noodles and toss gently to combine, until everything is warmed through. Taste and adjust seasoning if necessary. Transfer to a serving platter and top with peanuts, bean sprouts, and cilantro (if using). Serve with lime wedges, if desired. Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Pad Thai.
Pizza Dough
Take your homemade pizzas to the next level with this easy and delicious pizza dough recipe, made with only five simple ingredients. For a perfect crust on your homemade pizza, stromboli, or calzones, making your own pizza dough is the best choice. This simple process requires just five key ingredients: flour, salt, yeast, oil, and water. The dough takes only 10 minutes to mix and knead. Once combined, let the dough rise for at least 90 minutes in a warm, draft-free area before using it. This recipe yields 2 pounds of dough, enough for two large pizzas, four individual pizzas, two stromboli, or four calzones. You can prepare the dough up to two days ahead of time, and it also freezes well for later use. What you’ll need to make pizza dough Olive Oil: Adds richness to the dough and helps it crisp up beautifully in the oven. Salt: Provides essential flavor for the dough. Cornmeal: Used to dust the baking sheet, preventing the dough from sticking while baking, and adds a bit of extra crispiness and flavor to the crust. Yeast: Essential for making the dough rise. Instant yeast (also known as rapid-rise, quick-rise, or bread machine yeast) works best, though active dry yeast can also be used. If using active dry yeast, expect the rising time to take about 50% longer. You can activate it by rehydrating it in liquid before use (see the recipe for detailed instructions). Step-By-Step Instructions Mix the Dough To begin, combine the flour, yeast, and salt in the bowl of a stand mixer. Stir with a spoon to combine, and then add the oil and warm water. Stir until the dough comes together into a shaggy mass. Knead the Dough Fit the mixer with the dough hook and knead on medium-low speed until the dough is smooth and elastic, 5 to 7 minutes. (Alternatively, you can knead the dough by hand.) Let the Dough Rise Transfer the dough to a lightly oiled large bowl. Cover the bowl with plastic wrap or a damp kitchen towel, and let the dough rise in a warm place until it has doubled in size, 1 to 2 hours. There are a number of options that will work as places to let your dough rise: a sunny spot in your house, next to a heating vent (during colder months), or even on top of a kitchen appliance that generates a bit of heat as it runs (like your fridge). If you’re lucky enough to have a proof setting in your oven, use that. If not, but you’d like to use your oven, switch on the oven’s internal light; it will generate enough warmth to provide a good environment for the dough to rise. After the dough has risen, punch it down. Place the dough on a lightly floured surface. Cut the dough in half and roll each piece into a ball. If you’re not using the pizza dough right away, lightly coat the dough ball(s) with olive oil. Place into freezer bag(s) and seal shut, squeezing out all the air. Refrigerate for up to 2 days. When ready to use, let the dough sit out on the countertop for 30 minutes to warm up before stretching. Cover the dough with a damp kitchen towel and let it rest for 15 to 20 minutes. As you can see, it will rise a bit. Shape the Dough When it comes time to shape the pizza dough for baking, you can stretch it into any shape, size, or thickness you like (just keep in mind that a thicker crust will take longer to bake). Simply press and stretch the dough using your hands, dusting with more flour if necessary. General Baking Instructions Every pizza recipe is a little different, but as a general guideline: Preheat the oven to 500°F and set an oven rack in the bottom position. Dust a 13×18-inch baking sheet lightly with cornmeal. Place the stretched dough on the baking sheet, and gently stretch it out again so that it maintains its shape. Spread your sauce over the dough, leaving a 1/2-inch border around the edges. Slide the baking sheet into the oven and bake for 5 to 7 minutes, until the crust is partially cooked. Remove from the oven and scatter the cheese and toppings over the sauce. Slide the pan back into the oven and cook until the crust is golden brown and the cheese is melted and bubbling, 4 to 6 minutes more. To Refrigerate or Freeze The Pizza Dough If you’re not using the pizza dough right away, follow these steps for storing it. After the initial rise, lightly coat the dough ball(s) with olive oil. Place the dough into freezer bag(s), seal them shut, and remove as much air as possible. You can store the dough in the refrigerator for up to 2 days. When you're ready to use it, let the dough sit out on the countertop for about 30 minutes to warm up before stretching. For longer storage, the dough can be frozen for up to 3 months. To use frozen dough, simply defrost it in the refrigerator overnight (or for at least 12 hours). After defrosting, let it sit on the countertop for about 30 minutes to warm up before stretching and continuing with your pizza recipe. Note: This recipe was updated in January 2022 to make a slightly larger quantity. To see the original recipe, click here. Please find the original link here – Pizza Dough.
Chinese Vegetable Stir-Fry
Filled with meaty shiitakes, crunchy broccoli, and sweet bell peppers, this Chinese vegetable stir-fry always satisfies. As much as I know it’s true, I’m always amazed by how quick and easy it is to make excellent Chinese food at home. This Chinese vegetable stir-fry is filled with meaty shiitake mushrooms, crunchy broccoli, and sweet bell peppers in a gingery, garlicky brown sauce. Go ahead and buy your veggies ready-cut if possible to minimize prep time. And, as with any stir-fry, be sure to have all of your ingredients ready before you start cooking because it comes together quickly. The dish easily serves four as a side but if you’re making it as a vegetarian main course, count on two or three servings. What you’ll need to make a Chinese Vegetable Stir-Fry Step-by-Step Instructions Before you get started, chop the scallions, ginger, and garlic. You’ll need them at your fingertips once you start cooking. Next, whisk the soy sauce, water, dry sherry, sesame oil, sugar, cornstarch, red pepper flakes and dry mustard in a small bowl. Set aside. In a large nonstick skillet, bring 1 inch of water to a rapid boil. Add the broccoli and cook for 2-3 minutes, or until tender-crisp. (Blanching the broccoli ensures that it is perfectly cooked and bright green.) Strain the broccoli in a colander and then run under cold water to stop the cooking process. Set aside and allow to fully drain. Heat 2 tablespoons of vegetable oil in the skillet over high heat. Add the shiitake mushrooms and red peppers and cook, stirring occasionally, for 5-6 minutes, until the mushrooms are browned and the peppers are softened. Add the garlic, light-colored scallions, and ginger and cook, stirring constantly, until fragrant, about 30 seconds. Return the broccoli to the pan and cook until warmed through, about 1 minute. Add the reserved sauce. Toss and cook until the sauce is slightly thickened and the vegetables are evenly coated, about 30 seconds. Transfer to a serving dish and sprinkle with the dark green scallions. Serve with rice, if desired, and enjoy! Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Chinese Vegetable Stir-Fry.
Parmesan & Leek Quiche
A variation on the classic French cheese quiche, this Parmesan and leek quiche is rich and flavorful. When I was studying abroad in France, every day for lunch I would walk to the pastry shop near my university and treat myself to an individual quiche fromage — a delicious little habit that quickly cost me all my skinny jeans. Over 20 years later, it is still one of my favorite things to eat. This parmesan and leek quiche is a wonderful variation on the classic French cheese quiche; the leeks impart a mellow, almost sweet onion flavor while Parmesan cheese makes the custard filling extra flavorful. What You’ll Need To Make Parmesan & Leek Quiche I use a good-quality store-bought crust to save time but feel free to make your own if you prefer. The secret to success, whether you make the crust yourself or use pre-made, is to pre-bake it so it won’t be soggy. For the cheese, it’s important to use authentic Parmigiano Reggiano cheese for this recipe. You can always tell if it’s authentic by looking at the rind, which is embossed with the name over and over. If the cheese is already grated, it should be labeled “Parmigiano Reggiano,” not “Parmesan.” Leeks are part of the onion family, but they have a milder flavor. They’re notoriously sandy and dirty (and very good at hiding it) so it’s important to wash them well. To clean them, cut off and discard the root ends and thick dark green parts, then cut the leeks in half lengthwise. Rinse each half under cold water, pulling apart the layers to remove any grit that’s tucked inside. How To Make Parmesan & Leek Quiche To begin, preheat the oven to 400°F. Remove the pie shell from the freezer and thaw it until just soft enough to easily prick with a fork (10 to 20 minutes). Prick the bottom and sides all over with a fork and bake on the center rack until lightly golden, 10 to 15 minutes. Turn the oven down to 325°F. While the crust bakes, melt the butter in small sauté pan over medium-low heat. Add the leeks and season with a bit of salt and pepper. Cook over medium-low heat, stirring occasionally, until very soft, about 15 minutes. Do not brown. Taste and adjust seasoning (they should be well-seasoned). Set aside to cool. In a medium bowl, combine the heavy cream, eggs, thyme, nutmeg, Parmigiano Reggiano cheese, 1/4 teaspoon salt and 1/4 teaspoon pepper. Whisk well. Spread the cooked leeks over the pre-baked pie shell, taking care not to puncture the crust. Pour the egg mixture over top. Bake at 325°F for 45 to 55 minutes, or until the custard is set and puffed. The quiche will deflate as it cools. Slice into wedges and serve hot or warm. Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Parmesan & Leek Quiche.
Spinach Frittata
Stuffed with baby spinach and two kinds of cheese, this spinach frittata makes a lovely brunch, lunch, or light dinner. Filled with heaps of baby spinach and two kinds of cheese, this spinach frittata tastes nutritious and rich, all at the same time. It’s silkier and more quiche-like than most frittatas, which are usually just glorified omelets with the fillings mixed in rather than stuffed inside. The key is adding heavy cream and lots of cheese to the egg mixture. It’s also important to bake the frittata in a low-temperature oven (as opposed to the traditional stovetop-to-broiler method), so the eggs cook gently into a custard without scrambling. This frittata can be served for brunch, lunch, or a light dinner – and since it’s good warm or at room temperature, leftovers can be packed for lunch or taken on a picnic. What You’ll Need To Make Spinach Frittata Step-by-Step Instructions Heat the oil in a 10-inch ovenproof nonstick skillet over medium heat. Add the shallot and cook, stirring frequently, until softened, 3 to 4 minutes. Do not brown. Add half of the spinach and cook until wilted down, about 1 minute. Add the remaining spinach and 1/4 teaspoon of the salt and continue cooking until all of the spinach is wilted, 1 to 2 minutes more. Meanwhile, in a large bowl, combine the eggs, heavy cream, pepper, and the remaining 1/4 teaspoon salt. Whisk to combine. Add the cooked spinach mixture, Cheddar, Parmigiano Reggiano, and basil to the egg mixture. Stir to combine. Pour the mixture back into the pan (no need to wash it). Place the pan in the oven and bake until set, 20 to 23 minutes. Immediately place an oven mitt over the pan handle to remind yourself that it is hot (it’s easy to forget and burn your hand, and the handle stays hot for a long time). Serve the frittata directly from the pan, or use a rubber spatula to loosen the edges and slide the frittata onto a serving platter. Note: This recipe has been written by Jenn Segal and republished on MudMatter with Author’s Permission. Please find the original link here – Spinach Frittata.