Engineer’s Blog: Types and Uses of Generative AI

Hello, everyone! I’m “Pudding🍮” from the Business Development Department.
In this post, I’ll introduce the different types of generative AI—which is constantly evolving—and share some tips on how to use it effectively.

We operate an e-commerce site for international customers called “Dandelions Japan.”
We actively utilize AI for our social media management and video production.
For example, we use AI to generate ideas for posts and draft content, allowing us to efficiently create engaging material. We also leverage AI for image and video assets, which helps us produce high-quality visuals while reducing the time previously required for these tasks.

Types of Generative AI

While we often use the term “AI” as a general umbrella term, there are actually many different types.
Tools specialized for specific purposes—such as text-generation AI, image-generation AI, video-generation AI, and music-generation AI—are emerging one after another. Since each has its own areas of expertise, it’s important to choose the right one for your specific needs.

For example, by choosing the right tools—such as text-generating AI for writing and image-generating AI for visual design—you can achieve results more efficiently.

Specifically, ChatGPT is a leading example of text-generating AI, capable of handling a wide range of tasks such as brainstorming, writing, and summarizing.

Another example of image-generating AI is Midjourney, which can generate high-quality illustrations and photo-realistic images simply by entering text prompts.
In the field of video production, video-generating AI is being used to create videos from images and text, significantly contributing to more efficient production workflows.

In addition, there is Suno, a music-generating AI that allows you to create original songs simply by describing the desired mood in text.

Since each AI has its own areas of expertise, you can create higher-quality content by selecting the right one for your specific needs.

How to Write Effective Prompts

When using generative AI, one of the most important factors is how you write your prompts. Since generative AI generates results based on the input provided, ambiguous instructions will not yield the desired results. For example, when generating images, a simple prompt like “a woman in a kimono, cute” may lack specificity, resulting in an image that doesn’t match your vision.

On the other hand, by describing the subject, location, situation, and atmosphere in concrete terms—such as “A Japanese woman in her 20s, wearing a red and white kimono, stands smiling on Nakamise Street in Asakusa. The natural daylight creates a realistic look, just like in a photograph”—
you can achieve results that are closer to your ideal.

So, how should we approach prompts like this?
Actually, the example from earlier can be broken down into the following elements.

Subject (Who/What)
 Specify exactly what you want to draw (e.g., a Japanese woman in her 20s)

Action/Situation (What)
 Clearly describe what the subject is doing (e.g., standing with a smile)

Location/Background (Where)
 Specify the setting of the scene (e.g., Nakamise Street in Asakusa)

Artistic Style
 Specify the style of the drawing (e.g., realistic, like a photograph)

Photography / Realism
 Emphasize the level of realism (e.g., natural light, photorealistic)

Camera / Angle
 Specify the angle and composition (e.g., close-up, wide-angle, etc.)

Specifying Unnecessary Elements
 Exclude elements you do not want to be generated in advance (e.g., blurry images, low-quality images, text, watermarks, etc.)

Word order is even more important. Since the AI tends to place greater emphasis on elements mentioned earlier in the prompt, it’s crucial to list the most important elements—such as the subject—first.

Recently, as the accuracy of generative AI has improved, it’s now possible to get decent results even with relatively simple instructions. However, to achieve higher-quality results or output that more closely matches your vision, it’s important to design your prompts with these factors in mind.
By taking a little extra time to write specific instructions, you can maximize the potential of generative AI. If you keep these points in mind, you’ll be able to generate images that match your vision!

Summary

Generative AI is an incredibly useful tool that can significantly boost productivity and expand creative possibilities, depending on how it’s used. However, it’s not enough to simply use it; choosing the right tool and crafting effective prompts are also crucial.
We, too, will continue to leverage generative AI while keeping these points in mind, striving to create even better content.
We hope this information will be helpful to those who are interested in trying generative AI.

That’s all for today.
Thank you for reading.
Stay tuned for our next Engineer Blog post!

技術者ブログ:生成AIの種類や使い方について

皆さんこんにちは!業務開発部所属「プリン🍮」です。
今回は、日々進化を続ける生成AIの種類や上手な使い方について紹介します。

私たちは、「DandelionsJapan」という海外向けECサイトを運用しています。
そのSNS運用や動画制作において、AIを積極的に活用しています。
例えば、投稿内容のアイデア出しや文章作成にはAIを使用し、効率的に魅力あるコンテンツを作成しています。また、画像や動画の素材についてもAIを活用することで、これまで時間がかかっていた作業を短縮しながら、高品質なビジュアルを実現しています。

生成AIの種類

一口にAIといっても、その種類はさまざまです。
文章生成AI、画像生成AI、動画生成AI、音楽生成AIなど、用途ごとに特化したツールが次々と登場しています。それぞれ得意分野が異なるため、目的に応じて使い分けることが重要です。

例えば、文章作成には文章生成AI、ビジュアル制作には画像生成AIといったように、適切なツールを選ぶことで、より効率的に成果を出すことができます。

具体的には、文章生成AIとしてはChatGPTが代表的で、アイデア出しや文章作成、要約など幅広い用途に対応しています。

次に、画像生成AIとしてはMidjourneyがあり、テキストで指示を出すだけで高品質なイラストや写真風の画像を生成することができます。
また、動画制作の分野では、画像やテキストから映像を生成する動画生成AIが活用されており、制作の効率化に大きく貢献しています。

さらに、音楽生成AIとしてはSunoがあり、文章で雰囲気を指定するだけでオリジナルの楽曲を作ることが可能です。

このように、それぞれのAIには得意分野があるため、目的に合わせて適切に使い分けることで、より質の高いコンテンツ制作が実現できます。

上手なプロンプトの書き方

生成AIを活用するうえで特に重要なのが「プロンプト(指示文)」の書き方です。生成AIは入力された内容をもとに結果を生成するため、指示が曖昧だと期待通りの成果は得られません。例えば、画像生成において「着物の女性、かわいい」といった簡単な指示では、具体性に欠けるためイメージ通りの画像にならないことがあります。

一方で、「浅草の仲見世通りで、赤と白の着物を着た20代の日本人女性が笑顔で立っている。日中の自然光で、写真のようにリアルな表現」といったように、被写体・場所・状況・雰囲気などを具体的に書くことで、より理想に近い結果を得ることができます。

では、このようなプロンプトはどのように考えればよいのでしょうか。
実は、先ほどの例は以下のような要素に分解して考えることができます。

主題/被写体(Who / What)
 最も描きたいものを具体的に指定する(例:20代の日本人女性)

行動/状況(What
 主題が何をしているかを明確にする(例:笑顔で立っている)

場所/背景(Where)
 シーンの舞台を指定する(例:浅草の仲見世通り)

画風/芸術スタイル
 どのようなタッチで描くかを指定する(例:写真のようにリアル)

写真/写実性
 リアルさのレベルを強調する(例:自然光、フォトリアル)

カメラ/アングル
 視点や構図を指定する(例:クローズアップ、広角など)

不要な要素の指定
 生成してほしくない要素をあらかじめ除外する(例:ぼやけ、低品質、文字、透かしなど)

さらに重要なのが語順です。プロンプトは前に書いた要素ほどAIへの影響が強くなる傾向があるため、最も重要な要素(被写体など)を最初に書くことがポイントです。

最近では、生成AIの精度も上がってきているため、ある程度簡単な指示でもそれなりの結果は得られるようになっています。しかし、よりクオリティの高い成果や自分のイメージに近いアウトプットを得るためには、こうした要素を意識してプロンプトを設計することが重要です。
少し手間をかけて具体的に指示を書くことで、生成AIの能力を最大限に引き出すことができます。これらを意識すると、想像していたような画像が生成できるようになります!

まとめ

生成AIは非常に便利なツールであり、使い方次第で作業効率や表現の幅を大きく広げることができます。しかし、ただ使うだけでなく、適切なツールの選択やプロンプトの工夫が重要です。
私たちもこれらのポイントを意識しながら生成AIを活用し、より良いコンテンツ制作に取り組んでいきます。
本内容が、これから生成AIを使ってみたい方の参考になれば幸いです。

今回は以上になります。
ここまで読んでくださり、ありがとうございました。
次回の技術者ブログもお楽しみに!

Engineer’s Blog: Creating an Excel Macro (Move to Cell A1 and Set Zoom Level to 100%)

Hello! I’m Hirotomaru, and I’m writing this article.
In this post, I’ll show you how to use an Excel macro to “jump to cell A1 and reset the zoom level to 100%.”
You may have experienced situations where your scroll position or zoom level gets saved incorrectly, making the file hard to read the next time you open it. This macro makes it incredibly convenient to perform this action with just one click.

I will explain the steps for creating a macro shortcut button.

Show the Development tab

First, display the “Developer” tab to use macros.

  1. Click “File” in the upper-left corner
  2. Select “Other” → “Options”
  3. Open “Ribbon Customization”
  4. Check the “Development” box

Create a macro

1.Click “Record Macro” on the “Developer” tab

2.Enter the macro name, select “Personal Macro Workbook” under “Save macro in (I)”, and click “OK”

3.Without doing anything, click “Stop Recording”

Paste the code

Open the “Visual Basic” section in the Development tab and paste the following code into the Standard Module.
Delete all existing text, and replace “Sub MacroName()” on the first line with the macro name you entered when you created it.
Once you’ve pasted the code, save and close the file.

Sub A1 Shortcut()

‘ Disable screen updating (to prevent screen flickering)
Application.ScreenUpdating = False

Dim ws As Worksheet

Process all sheets in order
For Each ws In Worksheets

‘ Select a sheet
ws.Select

‘ Move to cell A1
Range(“A1”).Select

‘ Reset the display position to the top-left
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1

‘ Set the display zoom level to 100%
ActiveWindow.Zoom = 100

Next ws

Return to the first sheet
Sheets(1).Select

Resume screen updating
Application.ScreenUpdating = True

‘ Completion message
MsgBox “Processing is complete”

End Sub

In this case, I pasted the code into Module 7 of the standard modules.

Add to Favorites

Add to Shortcuts Since you can’t run the macro with a single click as it is, let’s add it to the Quick Access Toolbar so you can run it immediately.

  1. Open the Quick Access Toolbar settings
  2. Select the macro
  3. Add the macro you created (A1 Shortcut) and click OK

You can run it with a single click using the button in the upper-left corner.

Summary

By setting up the macro we’ve introduced here, you can easily reset the view position and zoom level for each sheet to their default settings. Since it can be executed with a single click, I believe it will help streamline your work. Please give it a try.

Stay tuned for our next engineer blog post!!

技術者ブログ:Excelのマクロ作成(A1セルに移動して倍率を100%にする)

こんにちは!今回の記事を担当しますひろとまるです。
今回は、Excelマクロを使って「A1セルに移動し、表示倍率を100%に戻す方法」をご紹介します。
スクロール位置や表示倍率がバラバラのまま保存されてしまい、次回開いたときに見づらいと感じることがあると思います。1クリックでこの操作をできるようになるのでとても便利です。


マクロショートカットボタンを作るまでの手順を説明していきます。

開発タブを表示する

まずはマクロを使用するために、開発タブを表示します。

1.左上の「ファイル」をクリック
2.「その他」→「オプション」を選択
3.「リボンのユーザー設定」を開きます
4.「開発」にチェックを入れます

マクロを作成する

1.「開発」タブから「マクロの記録」をクリック

2.マクロ名を入力して、マクロの保存先(I)で「個人用マクロブック」を選択し「OK」を押します

3. 何も操作せず「記録終了」をクリック

コードを貼り付ける

開発タブの「Visual Basic」を開き、標準モジュールところに以下のコードを貼り付けます。
元から入っている文字はすべて消して、一行目の「Subマクロ名()」には作成するときに入力したマクロ名を入れます。
貼り付けたら保存して閉じます。

Sub A1ショートカット()

‘ 画面更新を停止(画面のちらつきを防ぐ)
Application.ScreenUpdating = False

Dim ws As Worksheet

‘ すべてのシートを順番に処理
For Each ws In Worksheets

' シートを選択
ws.Select

' A1セルに移動
Range("A1").Select

' 表示位置を左上にリセット
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1

' 表示倍率を100%に設定
ActiveWindow.Zoom = 100

Next ws

‘ 1枚目のシートに戻る
Sheets(1).Select

‘ 画面更新を再開
Application.ScreenUpdating = True

‘ 完了メッセージ
MsgBox “処理が完了しました”

End Sub

今回の場合は標準モジュールのModule7にコードを貼り付けました。

ショートカットに登録する

このままだと1クリックでマクロを実行できないので、クイックアクセスツールバーに登録してすぐに実行できるようにします。
1.クイックアクセスツールバーの設定を開きます
2.マクロを選択します
3.作成したマクロ(A1ショートカット)を追加してOKを押します

左上のボタンから1クリックで実行できます。

まとめ

今回ご紹介したマクロを設定しておくことで、シートごとの表示位置や倍率を簡単に初期状態へ戻すことができます。ボタン一つで実行できるため仕事の効率化にもつながると思います。ぜひ活用してみて下さい。

次回の技術者ブログもお楽しみに!!

Engineer Blog: Sending Emails in OutSystems

In this engineer blog, I introduce the topics I study and work on in my daily learning.

Today’s Topic: Sending Emails in OutSystems

In OutSystems, you can send emails from screens or batch processes by using your own mail server.
In this post, I’ll walk through how to configure the environment and how to create a test screen.

Preparation: What You Need to Have Ready in Advance

OutSystems alone cannot send emails.
You need to prepare an email server in advance and make note of the following information:
#1.SMTP server
#2.SMTP port number
#3.Username (email address)
#4.Password
Depending on the type of mail server, there may also be options such as ‘restrictions on sending from overseas.’
If such a setting exists, be sure to turn it off.
Otherwise, you may encounter errors like ‘Sender address rejected: Incorrect country code US,’ which can prevent email delivery even when your configuration is correct.

Step 1: Environment Setup

First, enter the mail server information that OutSystems will use from Service Center. In Service Studio, click the gear icon shown below to access Service Center.

After logging in, open the email server settings by selecting Administration > Email

Enter the following information as shown below:
・SMTP Server: Preparation #1
・SMTP Port: Preparation #2
・Username: Preparation #3
・Password: Preparation #4
・Default Sender Email: Preparation #3
・Redirect Emails To Test List: Optional
 *This option redirects emails to the Test List Addresses even if the logic specifies a different recipient.
  Enable this for testing purposes.
・Test List Addresses: Optional
 *Specify the email address to which messages will be redirected.

After entering all the information, click the Save and Apply Settings to the Factory button to apply the configuration.
 *Note: Simply clicking ‘Save’ does not activate the email settings.
  Also, the Password field will appear blank after saving, but as long as the configuration is correct, emails will still be sent without any issues.

Step 2: Creating the Logic

This time, we will create a simple test screen and the logic for sending emails, as shown below.

① Test Screen: Enter the recipient, subject, and message body, then click the SendMail button to send an email based on the entered values.
② Email Body Screen: The value received through the InBody input parameter is displayed directly as the email body.
③ Client Action: This action is triggered when the SendMail button is clicked. It calls the server action responsible for sending the email.
④ Server Action: This action is called from the Client Action. It sends the email according to the layout created in step ②

Testing the Functionality

Once the 1‑Click Publish completes successfully, open the screen and try running it.

Example Input: To verify the redirect behavior, enter an email address in the top recipient field that is different from the one configured in Test List Addresses.
The email that was actually received at the address specified in Test List Addresses.

The top section shows the value of the Default Sender Email.
You can also see that the recipient field contains the address entered on the screen (which is different from the one specified in Test List Addresses), confirming that the redirect feature is working as expected.

Email sending logs in Service Center.

From Monitoring > Email, you can check the subject, sender/recipient email addresses, email size, and status.
In particular, the status may show Sent (success), Pending (waiting), or Error (failed). When an error occurs, you can click the Detail link to view the error information, which helps identify the cause.

Conclusion

With the above steps, you are now able to send emails from OutSystems.
However, one important point to keep in mind is that the actual email‑sending mechanism ultimately depends on the mail server.
Be sure to review the mail server settings carefully to ensure they meet your requirements—for example, limits on the number of emails that can be sent per hour, or restrictions on sending or receiving emails from specific addresses.

Stay tuned for the next developer blog…

技術者ブログ:(Outsystems)メールを送信する

技術者ブログとして日ごろ取り組んでいる学習内容を紹介します。

今回のテーマ:(Outsystems)メールを送信する

Outsystemsでは、各自で用意したメール送信サーバを用いることで、画面・バッチよりメールを送信することが出来ます。
今回は、環境設定と、テスト用画面の作成方法について紹介します。

準備:予め用意しておくもの

Outsystems単独ではメールを送信することはできません。
予め、メール送信サーバを調達し、以下の情報をメモしておきましょう:
#1.送信サーバ(SMTP)
#2.送信サーバのポート番号
#3.ユーザー名(メールアドレス)
#4.パスワード
また、メール送信サーバの種類にもよりますが、気を付けるべき点として「海外からの送信制限」のようなオプションがある場合、Offにしておきましょう。
“Sender address rejected: Incorrect country code US”のようなエラーが発生し、設定が正しいのにメールが送信できない場合があります。

手順1:環境設定

まず、ServiceCenterより、Outsystemsが使用するメール送信サーバの情報を入力します。
ServiceStudioより、下記歯車アイコンを押下し、ServiceCenterへアクセスしてください。

ログイン後、メニューよりAdministration>Emailとリンクを押下することで、メール送信サーバの設定画面が開きます。

それぞれ、次のように入力します:
・SMTP Server:準備#1
・SMTP Port:準備#2
・Username:準備#3
・Password:準備#4
・Default Sender Email:準備#3
・Redirect Emails To Test List:任意
 ※ロジックで宛先を指定しても、後述するTest List Addressesへメールをリダイレクトする機能です。
  動作確認のため、有効化しておきます。
・Test List Addresses:任意
 ※リダイレクト先のメールアドレスを設定します。

一通り入力し終えたら、Save and Apply Settings to the Factoryボタンを押下し、入力した設定値を反映しましょう。
 ※Saveするだけではメール設定は有効になりません。
  また、Save後Password欄は空欄になりますが、正しく設定できていればメールは送信できますので問題ありません。

手順2:ロジック作成

今回は、下記のようなシンプルなテスト画面、およびメール送信機能のロジックを作成します。

①テスト画面:宛先、件名、本文を入力し、SendMailボタンを押下することで入力値に基づきメールが送信される。
②メール本文画面。引数InBodyで受け取った値をそのままメール本文に表示する。
③ClientAction:SendMailボタン押下時に呼ばれる。メール送信用サーバアクションを呼び出す。
④ServerAction:ClientActionから呼び出される。②で作成したレイアウトに従い、メールを送信する。

動作確認

1-click publishが正常終了したら、画面を開いて動かしてみましょう。

入力例:リダイレクト動作確認のため、最上段の宛先メールアドレスには、Test List Addressesで設定したものと異なるメールアドレスを入力する。
実際にTest List Addressesに記載のメールアドレスにて受信したメール。

最上段にはDefault Sender Emailの値が記載されています。
また、宛先欄には画面で入力した宛先(≠Test List Addressesに記載のメールアドレス)が記載されており、リダイレクトが期待通りに機能していることが読み取れます。

ServiceCenterにおけるメール送信ログ。

Monitoring>Emailより、件名・送信元/先メールアドレス・メール容量・ステ―タスが確認できます。
特に、ステータスはSent(送信完了)・Pending(待機中)の他にError(送信失敗)になる場合があり、この時表示されるDetailリンクからエラー内容を確認できるため、原因の特定に役立てることができます。

まとめ

以上の手順にて、Outsystemsよりメールを送信することができるようになりました。
ただし、一つ気を付けておかなければならないのは「あくまでメール送信の仕組み自体はメール送信サーバに依存している」ことです。
時間当たりの送信可能メール数や、特定のメールアドレスから/へのメール送受信を許可しない設定など、要件に合わせたカスタマイズが送信サーバ側の設定をよく確認しましょう。

それでは、次回の技術者ブログをお楽しみに…。

Engineering blog – 5 Useful Java Features in Modern Java

Java has evolved significantly over the past decade. While many developers still associate Java with verbose syntax and heavy boilerplate, modern Java versions (Java 8 and beyond) introduced powerful features that make development cleaner, safer, and more expressive.

In this article, we’ll explore five useful Java features that every developer should know and start using today.

1. Lambda Expressions

Lambda expressions allow you to write concise, functional-style code. They eliminate the need for anonymous classes and make your code easier to read.

Before Java 8:

Runnable r = new Runnable() {
    public void run() {
        System.out.println("Hello World");
    }
};

With Lambda:

Runnable r = () -> System.out.println("Hello World");

Why It’s Useful:

  • Reduces boilerplate code
  • Improves readability
  • Encourages functional programming

Lambda expressions are widely used with Streams, collections, and event handling.


2. Stream API

The Stream API allows you to process collections in a declarative and functional style.

Example:

List<String> names = List.of("Alice", "Bob", "Andrew");

names.stream()
     .filter(name -> name.startsWith("A"))
     .map(String::toUpperCase)
     .forEach(System.out::println);

Benefits:

  • Clear and expressive data processing
  • Supports parallel execution
  • Encourages immutability

Streams make complex data transformations readable and maintainable.


3. Optional Class

Optional helps avoid NullPointerException by explicitly representing a value that may or may not exist.

Example:

Optional<String> username = Optional.ofNullable(getUsername());

username.ifPresent(System.out::println);

Why It Matters:

  • Encourages null-safe coding
  • Makes APIs clearer
  • Reduces runtime errors

Instead of returning null, methods can return Optional<T> to express uncertainty.


4. Records (Java 16+)

Records provide a concise way to create immutable data classes.

Example:

public record User(String name, int age) {}

The compiler automatically generates:

  • Constructor
  • Getters
  • equals() and hashCode()
  • toString()

Advantages:

  • Less boilerplate
  • Immutable by default
  • Ideal for DTOs

Records are perfect for modeling simple data carriers.


5. Switch Expressions

Modern Java allows switch to return values and use arrow syntax.

Example:

String dayType = switch (day) {
    case "Sat", "Sun" -> "Weekend";
    default -> "Weekday";
};

Why It’s Better:

  • More concise syntax
  • No need for break
  • Fewer bugs

Switch expressions improve readability and reduce accidental fall-through errors.


Modern Java focuses on: Cleaner syntax, Safer code and Better developer experience.

If you’re still using older Java patterns, upgrading your style to include these features can dramatically improve your productivity and code quality.

Stay tuned for our next article!

技術ブログ – モダンJavaの便利な機能5選

Javaはこの10年で大きく進化しました。多くの開発者はいまだに、冗長な構文や大量のボイラープレートコードを連想するかもしれませんが、モダンJava(Java 8以降)では、よりクリーンで安全、そして表現力の高い開発を可能にする強力な機能が導入されています。

この記事では、すべての開発者が知っておくべき5つの便利なJava機能を紹介します。

1. ラムダ式(Lambda Expressions)

ラムダ式を使うことで、簡潔な関数型スタイルのコードを書くことができます。無名クラスを使う必要がなくなり、コードの可読性が向上します。

Java 8以前:

Runnable r = new Runnable() {
    public void run() {
        System.out.println("Hello World");
    }
};

ラムダ式を使うと:

Runnable r = () -> System.out.println("Hello World");

メリット:

  • ボイラープレートコードの削減
  • 可読性の向上
  • 関数型プログラミングの促進

ラムダ式は、Stream APIやコレクション操作、イベント処理などで広く利用されています。


 

2. Stream API

Stream APIを使用すると、コレクションを宣言的かつ関数型スタイルで処理できます。

例:

List<String> names = List.of("Alice", "Bob", "Andrew");

names.stream()
     .filter(name -> name.startsWith("A"))
     .map(String::toUpperCase)
     .forEach(System.out::println);

メリット:

  • 明確で表現力の高いデータ処理
  • 並列実行に対応
  • イミュータブルな設計を促進

Streamを使うことで、複雑なデータ変換も読みやすく保守しやすいコードになります。


 

3. Optionalクラス

Optionalは、値が存在するかどうかを明示的に表現することで、NullPointerExceptionを回避するのに役立ちます。

例:

Optional<String> username = Optional.ofNullable(getUsername());

username.ifPresent(System.out::println);

重要なポイント:

  • null安全なコーディングを促進
  • APIの意図が明確になる
  • 実行時エラーの削減

メソッドがnullを返す代わりに、Optional<T>を返すことで、値が存在しない可能性を明確に表現できます。


 

4. Records(Java 16以降)

Recordは、不変なデータクラスを簡潔に作成するための機能です。

例:

public record User(String name, int age) {}

コンパイラが自動的に生成するもの:

  • コンストラクタ
  • Getterメソッド
  • equals()hashCode()
  • toString()

メリット:

  • ボイラープレートの削減
  • デフォルトでイミュータブル
  • DTOに最適

Recordは、シンプルなデータ保持用クラスのモデリングに最適です。


 

5. Switch式(Switch Expressions)

モダンJavaでは、switchが値を返せるようになり、アロー構文(->)も使用できます。

例:

String dayType = switch (day) {
    case "Sat", "Sun" -> "Weekend";
    default -> "Weekday";
};

優れている点:

  • より簡潔な構文
  • breakが不要
  • バグの減少

Switch式は可読性を向上させ、意図しないフォールスルー(fall-through)によるエラーを防ぎます。


 

モダンJavaが目指しているのは、よりクリーンな構文、より安全なコード、そして優れた開発者体験です。

もしまだ古いJavaの書き方を使っているなら、これらの機能を取り入れることで、生産性とコード品質を大きく向上させることができます。

次回の記事もお楽しみに!

Setting Up a Vue 3 Development Environment on Windows Using Cursor

As a tech blog, I’d like to share what I’ve been learning recently.
This time, I’ll walk you through how I set up a Vue 3 development environment using Cursor, a code editor with built-in AI features.

Requirements

・Node.js
・Cursor
・Vue3
・Vue Router

Installing Node.js

Download the installer from the official website
The latest version at the time of writing is 24.12.0 (LTS)
Download the Windows installer

Follow the installation wizard. If you don’t have any specific preferences, just clicking ‘Next’ through all the steps is fine.

You can basically keep clicking ‘Next’ here as well, but if you plan to use various Node.js modules in the future, it’s a good idea to check this option.
However, it’s not necessary for this setup.

That’s it! Node.js is now set up and ready to go.

Installing Cursor

Download the installer from the official website.
The latest version at the time of writing is 2.2.44.
If you don’t have any specific preferences, you can proceed with the default settings during installation.
After installation, you’ll be prompted to log in, so it’s a good idea to create an account on the official website beforehand for a smoother setup.

Adding Extensions to Cursor

Add the following extensions to Cursor

  • Japanese Language Pack for VS Code
    ・Japanese localization
  • npm
    ・Support for npm
  • Npm Intellisense
    ・Auto-completion for npm modules in import statements
  • Vue (Official)
    ・Support for Vue
  • Vite
    ・Support for Vue development server

Creating a Vue 3 Project

Go to File > Open Folder and open the location where you want to create your project.

Open the terminal with [Ctrl + @]

Run the following command in the terminal to create the project

npm create vue@latest

Type ‘y’

Enter your preferred project name and package name.

Select the packages you want to add.

Give it a try

  • TypeScript
    ・Must be added
  • JSX Support
    ・Enables writing Vue in JSX/TSX syntax. Add this if you prefer a React-like style.
    ・Turned off for this setup.
  • Router
    ・Essential for page navigation
    ・Must be added
  • Pinia
    ・State management library
    ・Add if you need to manage login info, user data, or shared state
  • Vitest
    Add if you want to automate unit testing
  • End-to-End Testing
    ・Add if you want to automate tests that include browser interactions
  • ESLint
    ・Linting tool to check code style
    ・Must be added
  • Prettier
    ・Automatically formats your code
    ・Must be added

You’ll be asked whether to enable experimental features. Since we won’t be using them this time, just press Enter to keep the default.

You’ll be asked whether to create the project without sample code.
For this setup, select ‘No’ to include the sample code.

The project creation will begin, and once it’s complete, a project folder will be generated.

Reopen the created project folder in Cursor and run the following command

PS C:\vue3\startupVue> npm install

Once the dependencies are installed, the project setup is complete.

Starting the Vue app

Run the following command to start the development server

npm run dev

If the launch is successful, the following screen will be displayed

You can stop the server by typing [q] in the console.

That’s it! We’ve set up a Vue 3 development environment using Cursor.
If this sparked your interest, try setting it up on your own PC too!

Windows環境のCursorでVue3開発環境を作ってみる

技術者ブログとして日ごろ取り組んでいる学習内容をご紹介します。
今回はAI機能を搭載したコードエディタCursorでVue3の開発環境を作ってみたので紹介します。

必要なもの

・Node.js
・Cursor
・Vue3
・Vue Router

Node.jsのインストール

公式サイトよりインストーラを取得
記事作成時最新は「24.12.0(LTS)」
Windowsインストーラをダウンロード

インストールウィザードに沿ってインストール、特にこだわりがなければすべてNextでOK

以下も基本的にNextで大丈夫ですが、今後Node.jsのいろいろなモジュールを使用した場合は
チェックを入れておくといいです。
今回の環境では不要です。

以上でNode.jsが準備できました。

Cursorのインストール

公式サイトよりインストーラーを取得します。
記事作成時最新は「2.2.44」
とくにこだわりがなければ、インストーラーデフォルト設定のままインストールでOK
インストール後、ログインが求められるのであらかじめ公式サイトのログインからアカウント登録しておくとスムーズに進みます

Cursorに拡張機能の追加

Cursorに以下の拡張機能を追加します

  • Japanese Language Pack for VS Code
    • 日本語化
  • npm
    • npmのサポート
  • Npm Intellisense
    • importステートメント内のnpmモジュール自動補完
  • Vue (Official)
    • Vueのサポート
  • Vite
    • Vue開発サーバーのサポート

Vue3プロジェクトを作成

ファイル > フォルダーを開くでプロジェクトを作成したい場所を開く

[Ctrl + @]でコンソールを開く

コンソールで以下のコマンドを実行しプロジェクトを作成

npm create vue@latest

yを入力

お好きなプロジェクト名、パッケージ名を入力

追加したいパッケージを選択します

実行してみる

  • TypeScript
    • 必ず追加
  • JSX Support
    • JSX/TSX で Vue を書くための機能、React風に書きたい場合は追加
    • 今回はOFF
  • Router
    • 画面遷移に必須
    • 必ず追加
  • Pinia
    • 状態管理ライブラリ
    • ログイン情報・ユーザー情報・共通データなどを扱う場合は追加
  • Vitest
    • 単体テスト自動化するなら追加
  • End-to-End Testing
    • ブラウザ操作を含むテストを自動化するなら追加
  • ESLint
    • コードの書き方チェック
    • 必ず追加
  • Prettier
    • コード自動整形
    • 必ず追加

実験的機能を使うか聞かれる今回は使用しないため初期のままEnter

サンプルコードを省略して作成するか確認されるので今回は「No」を選択し
サンプルコードを追加

プロジェクトの作成が始まり完了するとプロジェクトフォルダが作成される

作成したプロジェクトフォルダをcursorを開きなおし以下のコマンドを実行

PS C:\vue3\startupVue> npm install

依存関係のインストールが完了すればプロジェクトの準備完了

Vueの起動

以下のコマンドを実行すると開発サーバーを実行することができます

npm run dev

起動に成功すると以下の画面が表示される

コンソールに[q]を入力することでサーバーを停止できます

以上、CursorでVue3の開発環境を構築してみました。
興味が持てましたら自分のPCにも構築してみてください。