Вы можете использовать следующий код
public class ProductModel {
private Object meta_data = null;
...
}
и привести его на основе полученного ответа, используя ключевое слово instanceof , например,
if(response instanceof List){
//iterate list.
}
if(response instanceof Object){
//use object.
}
Книга Code Complete 2 - это вневременной справочник по хорошей практике кодирования.
Абсолютным «нужно прочитать» для вас является книга Роберта К. Мартина «Чистый код» . Попробуй. Это делает некоторые удивительные замечания. Я продолжаю рекомендовать всем с тех пор, как купил его 6 месяцев назад.
Редактировать
Я думал, что чтение моего обзора Amazon может помочь:)
Включая полный код и чистый код Я рекомендую вам прочитать «Прагматичный программист» и «Отправь!». Последние упомянутые книги не столько о том, как форматировать код, комментарии и т. Д. а скорее о лучших практиках для разработчиков и разработчиков.
You're asking for Coding Standards, which are language specific.
For C# check out The IDesign C# Coding Standard (on the right-side of the screen in the middle of the page)
For .NET in general see Design Guidelines for Developing Class Libraries
For C++ check here
For Java see Sun's resource Code Conventions for the JavaTM Programming Language
Three books I consider essential for beginning OO programmers.
Although modern IDEs often support automatic refactor, this book is still useful. By knowing the reason (or code smell) behind a particular refacoring, you can strive to write the correct code the first time.
A wealth of best practices.
Most advanced book, but still useful.
Clean Code is certainly a good book. Martin's Agile Principles, Patterns, and Practices in C# is my recommendation if you want a more .NET specific book.