Replies: 1 comment 2 replies
-
Hey @devtekve, thanks for such a detailed feedback, I really appreciate it! I'd like to go through your points and comment on them. 1. Lack of comparative examples against AWS SDKThat's a valid point. Docs with comparison to the .NET AWS SDK can be really handy and help a lot in learning how to do stuff with EfficientDynamoDb. The link you provided can be quite useful to compile examples. I'm not a fun of how these examples are structured but there is still some code that can be repackaged for better representation. It's going to take quite a lot time to create examples for all features so I think it makes sense to select the most painful/complicated area and start with that. In my opinion it can be using queries as there are quite a lot operations and some of them can be confusing and/or complicated. Do you have any thoughts on that topic as you did the migration recently? 2. Lack of a compatibility layer with AWS SDKThat's true that we didn't want to support some features because they encourage inefficient operations against the DB. And you have a valid point that a compatibility layer can be helpful during the adoption of EfficientDynamoDb. That said, we do have some compatibility features that are supposed to help with migration from AWS SDK, such as re-using credentials, Are there any particular features that you missed during the migration? There is a chance that we overlooked something and it can be added to the compatibility layer after all. 3. Attribute Annotation Requirements in EfficientDynamoDbThis one is really tricky. On one hand I see what you mean and want and your suggestion make sense. But on the other hand, there are some reasons why things were done this way.
config.ForEntity<TEntity>()
.SetProperty(x => x.PartitionKeyProperty, "pk", DynamoDbAttributeType.PartitionKey)
.SetProperty(x => x.SortKeyProperty, "sk", DynamoDbAttributeType.SortKey)
.SetProperty(x => x.FirstName, "first_name")
.SetProperty(x => x.Age, "age"); So the idea that it looks similar to attributes but doesn't require changing the model classes. It's not a final API at this point and I haven't checked what would be an effort of implementing this but it's something I would like to do at some point. Any thoughts on going this way? 4. Table Name FlexibilityThis one can be solved as well by implementing the external configuration from the previous section. I agree that it can be a pain if you're loading table names at runtime. The only workaround I can suggest for now is using an empty name in I understand that it's not pretty but unfortunately, this is the only way for now. 5. Issues encountered with the WithTableName when using QueryAsyncI already responded to the bug report you created so not going to repeat everything here again. TL;DR for someone who stumble on this comment looking for answer. You have to use |
Beta Was this translation helpful? Give feedback.
-
Sorry for the long wall of text, take a cup of coffee and read away. I took the liberty of using ChatGPT to help me write and phrase some of the text below, but it's not something I simply dropped and left. I am writing some background context so that you can understand what I've tried and how I am trying to use EfficientDynamoDb.
Background and Current Practices
With 2-3 years of experience using the AWS SDK, I've become proficient with its features and limitations. My architectural approach employs a modified repository pattern to effectively manage data operations across different application layers, enhancing data abstraction and encapsulation.
Data Model Architecture
I've described a structured approach to data management using three primary models, each serving distinct purposes:
RoleModel
is embedded within theUserEntity
as a collection, rather than as a standalone entity. This setup allows for dynamic user role management within our systems.C# Implementation Examples
Here’s a combined code block showing how these models could be implemented in C#:
Advantages of Modified Repository Pattern
This structure not only ensures a clean separation of concerns across different layers but also supports complex data relationships seamlessly. By defining specific roles for each model, we maintain data security and enhance the system's ability to manage complex interactions efficiently.
The feedback, structured (mostly).
1. Lack of comparative examples against AWS SDK
As an experienced user of the AWS SDK transitioning to EfficientDynamoDb, I appreciate the streamlined and more efficient query capabilities of your library. However, I've noticed a gap in the documentation when it comes to complex operations. For instance, while the transition to EfficientDynamoDb simplified my code, I initially struggled with how to handle sort keys effectively due to a lack of detailed examples.
It would be immensely helpful if the documentation could include more comprehensive, comparative examples that show how to translate complex AWS SDK operations into EfficientDynamoDb operations, especially those involving sort keys and complex filters. Detailed guidance on query configurations and best practices in EfficientDynamoDb would also be invaluable for developers looking to fully utilize your promising tool without resorting to guesswork.
Ideas
One wonderful example of how EfficientDynamoDb makes you enjoy life more
2. Lack of a compatibility layer with AWS SDK
I recognize that some of the design decisions in EfficientDynamoDb—such as not providing a direct 'drop-in' replacement for the AWS SDK—were likely made with specific intentions, possibly to encourage best practices or optimize performance. However, I believe that implementing a compatibility layer could significantly streamline the adoption process, particularly for teams that are generally more resistant to change.
Introducing such features would not undermine the original goals of EfficientDynamoDb but rather enhance its accessibility and ease of integration. This approach could serve as a bridge, allowing teams to gradually familiarize themselves with EfficientDynamoDb’s unique capabilities while still maintaining their existing workflow during the transition phase.
By lowering the initial barriers to entry, EfficientDynamoDb could appeal to a broader audience and ease the transition process, ultimately facilitating a smoother shift to more efficient and readable code practices. This strategy aligns with the broader goals of enhancing user satisfaction and expanding the user base, making it easier to 'sell' the adoption of EfficientDynamoDb within organizations that may be hesitant about adopting new technologies.
3. Attribute Annotation Requirements in EfficientDynamoDb
One more aspect that I’ve found challenging with EfficientDynamoDb is its approach to property annotations. The library requires developers to use the
[DynamoDbProperty(name)]
attribute for each property in a class that interacts with DynamoDB. This requirement has posed two main problems for me:Attribute Flexibility: Currently, the attribute necessitates specifying a property name, which could be more streamlined. An overload that automatically derives the property name from the class property it’s mapped to would greatly simplify the implementation. This would allow developers to maintain clean code while still ensuring that properties are correctly mapped to DynamoDB attributes. (See Adding [CallerMemberName] to 3 new overloads for the DynamoDbPropertyAttribute #240 for a proposal to fix)
Model Agnosticism: Some of my models, like
RoleModel
, are designed to remain database-agnostic, adhering to the principle of separation of concerns. However, EfficientDynamoDb’s current approach requires these models to be explicitly annotated with DynamoDB attributes, which introduces unnecessary coupling between the data models and the database implementation details. Ideally, there should be an option to enable automatic mapping of class properties without explicit annotations, with the ability to use something like[DynamoDbIgnore]
for exceptions, similar to the AWS SDK.Being able to toggle between explicit and implicit mapping would provide the flexibility needed in various development scenarios and align better with the principles of clean architecture by reducing the need for database-specific details in domain models
4. Table Name Flexibility
While migrating to EfficientDynamoDb, I've encountered difficulties in managing table names dynamically, a feature crucial for maintaining different environments (development, staging, production) seamlessly. In the AWS SDK, I could easily configure table names at runtime using environment variables / appsettings, like so:
However, EfficientDynamoDb seems to require hardcoding the table name as an attribute or passing it with every query (although not every query supports this properly at the moment, read below for details), which is less efficient and introduces redundancy in the code. An alternative or enhancement in EfficientDynamoDb that allows for similar flexibility as AWS SDK would greatly streamline development processes and better support multiple environment configurations.
5. Issues encountered with the
WithTableName
when usingQueryAsync<T>
I have encountered an inconsistency with the
WithTableName
method when attempting to dynamically set table names for queries. For instance, using the following code results in a type compatibility error:The error suggests a type mismatch with
System.Threading.Tasks.Task<TEntity>
andEfficientDynamoDb.Operations.Shared.ITableBuilder<System.Threading.Tasks.Task<TEntity>>
. I've made a separate bug report for this #235Final thoughts
As I reflect on my experience with EfficientDynamoDb, I am truly impressed with what it offers. The simplicity, ease of use, and the notable performance enhancements have significantly exceeded my expectations. These aspects make EfficientDynamoDb a compelling choice for my personal projects and a potential candidate for professional applications.
Although there are a few areas I believe could be refined—such as dynamic table naming and more detailed documentation for complex queries—my feedback is meant to be constructive. I see great potential in this tool, and these suggestions are intended to help reach that potential.
I am eager to hear from current contributors about their views on these suggestions. My goal is to foster a constructive dialogue that could lead to further enhancements, making this excellent tool even better.
Thank you to everyone involved in this project for your hard work and dedication. It's exciting to be part of such an innovative effort, and I look forward to seeing how it evolves.
Beta Was this translation helpful? Give feedback.
All reactions