You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
9 Hrs
15 Min
3 Seg

Creación de entidades

27/32
Resources

How can we improve our educational solution?

In our journey towards a more robust and structured educational system, it is crucial to deepen how we structure the entities that are part of it. At this stage, we are going to focus on adding new entities to our solution: students, subjects and assessments.

The goal is to increase functionality, providing a faithful and functional representation of the educational environment, which is essential for the good development of any software in the industry. Let's see how to do this with the proper use of classes in C#.

How do you create classes for new entities?

We start by evaluating what attributes each entity should carry and how to create them properly in C#. Therefore, we are going to create new classes for each of the entities:

  1. Student: the fundamental attributes of a student can include a Unique ID (also called a code) and a name. It is defined using the GUID system, guaranteeing a unique ID generated in the constructor.
public class Alumno { public string Nombre { get; set; } public string UniqueID { get; private set; }    
 public Alumno() { UniqueID = Guid.NewGuid().ToString(); } }}
  1. Assignment and Assessments: Both entities genesis of with a similar structure thanks to code reuse and the idea of maintaining consistency and order in programming.

What are the important features of advanced classes?

In our solution, it is paramount to understand that assessments are directly related to subjects and students. Each evaluation contains a Unique ID, name, the student who submits it, to which subject it belongs and the grade obtained, which is recommended to be handled as a float type for the inclusion of decimals.

public class Evaluacion { public string UniqueID { get; private set; } public string Nombre { get; set; } public Alumno Alumno { get; set; } public Asignatura Asignatura { get; set; } public float Nota { get; set; }    
 public Evaluacion() { UniqueID = Guid.NewGuid().ToString(); } }}

How to integrate subject and student lists into courses?

A course is not complete without recognizing which subjects and students it contains. Each course, therefore, must have an associated list of subjects and students, facilitating the access and manipulation of this data.

public class Course { public string Name { get; set; } public List<Subject> Subjects { get; set; } public List<Student> Students { get; set; }
 public Course() { Subjects = new List<Subject>(); Students = new List<Student>(); } }}

What final considerations should we have?

When finalizing the structuring of our entities, it is vital to remember the importance of design decisions. Each object created must be built with a clear purpose within the educational model. In C#, we have the flexibility to include multiple classes in a file without error, but maintaining organization will help significantly in the long run.

As we move forward, students will be encouraged to apply these concepts in the creation and manipulation of objects, thus increasing their programming skills and understanding of complex educational systems. Keep moving forward and improving your knowledge!

Contributions 22

Questions 7

Sort by:

Want to see more contributions, questions and answers from the community?

Algo que podríamos hacer para evitar duplicidad y favorecer la reutilización de código, es aplicar herencia. Id y Nombre, son dos propiedades que están en muchos objetos del sistema. Podríamos sacarlos, en una clase padre, y que las demás clases hereden de esta clase padre sus propiedades.

En mi caso hice algo así:

  public class EnteSistema
    {
        public string Id { get; set; }

         public string Nombre { get; set; }
    }
   public class Alumno: EnteSistema
    {
        public Alumno() => (this.Id) = (Guid.NewGuid().ToString());   
    }
 public class Asignatura: EnteSistema
    {
        public Asignatura() => (this.Id) = (Guid.NewGuid().ToString());   
    }

Yo deje el nombre de todas mis clases en singular.

Opino igual, la forma en la que esta llevando el curso es genial, vas armando el proyecto poco a poco. Excelente

Muy bien guiado el curso con este proyecto implementando cada cosa que se requiere y se va aprendiendo aplicando los conocimientos

En esta clase se creará más entidades para seguir con el desarrollo de nuestro proyecto:

  • Alumno
  • Asignatura
  • Evaluaciones

Para cada una de las entidades nuevas se definió que deberá tener un ID único , ejemplo de la entidad Alumno.

using System;

namespace CoreEscuela.Entidades
{
    public class Alumno
    {
         public string Nombre {get;set;}
        public string UniqueId {get;set;}

         public Alumno()
        {
            UniqueId=Guid.NewGuid().ToString();
        }
    }
}

Además en Curso se agregaron dos campos más que son la de:

  • Asignatura de ese curso
  • Alumno para ese curso

En evaluación:

  • Alumno que da la evaluación
  • La asignatura de esa evaluación
  • La calificacion / nota de esa evaluación

Lo correcto era que hubiera creado una clase en singular llamada Evaluacion y en la asignatura tener una propiedad Evaluaciones = new List<Evaluacion>

Definitivamente el mejor profesor de Platzi.
Mejor dicho, este señor es un maestro.

Para la industria el tipo de dato más recomendable es decimal

Va mejorando en cada clase

Genial, :V 😃 cada dia me gusta mas este lenguaje

NO hay comentarios? O_O

lo importante, debió aplicar la herencia

Creo que el código se podría optimizar creando una clase abstracta que tenga los Guid y nombres

Excelente.

Buena clase

Alumnos, Profesor, Asignatura,Jornada, Pesun, Horarios, Sanciones, Listas Ausencias, Listas de Reposos, Laboratorios, Salones,

Evaluación debería ir dentro de Asignatura y Asignatura dentro de Alumno.
Alumno > Asignatura > Asignatura.
Para mi es mas fácil de organizarlo así.

Queda claro que el modelado es una parte importante de la creación de código ya que con base al modelo podemos ver que estructura es la que nos conviene mas

el modelo puede cambiar en cada realidad, la idea central es que debemos tener un modelo para poder guiarnos y tomarlo como guia para codear.

Que buen dominio del tema.

Más rápido no podía hablar…

Se podría entonces transformar las clases “TipoJornada” y “TipoEscuela” como colecciones ?